In 1075, Wang Anshi, the prime minister, told the Song Dynasty emperor that Đại Việt was being destroyed by Champa, with less than ten thousand soldiers surviving, hence it would be a good occasion to annex Đại Việt. The Song emperor mobilized troops and passed decrees to forbid all the provinces to trade with Đại Việt. Upon hearing the news, the Lý ruler sent Lý Thường Kiệt and Nùng Tôn Đản with more than 100,000 troops to China to carry out a pre-emptive attack against the Song Dynasty troops. In the ensuing 40-day battle near modern-day Nanning, the Đại Việt troops were victorious, capturing the generals of three Song armies.