The conquest of Semigallian counties started in 1219 when crusaders from Rīga occupied Mežotne, the major port on the Lielupe waterway, and founded the Bishopric of Semigallia. After several unsuccessful campaigns against the pagan Semigallian duke Viestards and his Samogitian kinsfolk, the Roman Curia decided in 1251 to abolish the Bishopric of Semigallia, and divided its territories between the Bishopric of Rīga and the Order of Livonia. In 1265 a stone castle was built at Jelgava, on the Lielupe, and became the main military base for crusader attacks against the Semigallians. In 1271 the capital hillfort of Tērvete was conquered, but Semigallians under the Duke Nameisis rebelled in 1279, and the Lithuanians under Traidenis defeated Livonian Order forces in the Battle of Aizkraukle. Duke Nameisis' warriors unsuccessfully attacked Rīga in 1280, in response to which around 14,000 crusaders besieged Turaida castle in 1281. To conquer the remaining Semigallian hillforts the Order's master Villekin of Endorpe built a castle called Heiligenberg right next to the Tērvete castle in 1287. The same year the Semigallians made another attempt to conquer Rīga, but again failed to take it. On their return home Livonian knights attacked them, but were defeated at the Battle of Garoza, in which the Orders' master Villekin and at least 35 knights lost their lives. The new master of the Order Cuno of Haciginstein organised the last campaigns against the Semigallians in 1289 and 1290; the hillforts of Dobele, Rakte and Sidarbe were conquered and most of the Semigallian warriors joined the Samogitian and Lithuanian forces.. How many years after Tērvete castle was conquered was Heiligenberg castle built?