The Song dynasty managed to win several military victories over the Tanguts in the early 11th century, culminating in a campaign led by the polymath scientist, general, and statesman Shen Kuo (1031–1095). However, this campaign was ultimately a failure due to a rival military officer of Shen disobeying direct orders, and the territory gained from the Western Xia was eventually lost. The Song fought against the Vietnamese kingdom of Đại Việt twice, first conflict in 981 and later a significant war from 1075 to 1077 over a border dispute and the Song's severing of commercial relations with Đại Việt. After the Vietnamese forces inflicted heavy damages in a raid on Guangxi, the Song commander Guo Kui (1022–1088) penetrated as far as Thăng Long (modern Hanoi). Heavy losses on both sides prompted the Vietnamese commander Thường Kiệt (1019–1105) to make peace overtures, allowing both sides to withdraw from the war effort; captured territories held by both Song and Vietnamese were mutually exchanged in 1082, along with prisoners of war.