Occupation and new independence
1284, Stepan Uroš II Milutin of the former Serbian Nemanjić dynasty rebelled against the Hungarians. Fightings went on for several years, but at the end, the Hungarians proved stronger.
1303-07, another Serbian rebellion under Stepan Hrebeljanović took place. At the end, Hungary had to give them independence. The new Serbia under czar Stepan also included Bosnia.
But meanwhile, a new threat had emerged. In 1319, the young Serbia clashed with the Rum-Seljuks in Macedonia, but was defeated. 1323, Serbia invaded the crusader states of Epirus and Thessalia, but lost them a few years later again.
The end came in 1364-69, when the Rum-Seljuks battled the allied Serbians and Bosnians, defeated them and occupied their lands.