Bulgar–Serb War (839–842)
The Bulgarian-Serbian War of 839–842 was fought between the Bulgarian Khanate and the Serbian Principality. It was the first conflict of the medieval Bulgarian–Serbian Wars.

Prelude
According to De Administrando Imperio, the Serbs and Bulgars had lived peacefully as neighbours until the Bulgarian invasion in 839 (in the last years of emperor Theophilos). It is not known what exactly prompted the war, as Porphyrogenitus gives no clear answer; whether it was a result of Serbian–Bulgarian relations, i.e. the Bulgarian conquest to the southeast, or a result of the Byzantine-Bulgarian rivalry, in which Serbia was at the side of the Byzantines as an Imperial ally. It was not unlikely that the Emperor had a part in it; as he was in war with the Arabs, he may have pushed the Serbs to drive the Bulgars from western Macedonia, which would benefit them both. According to J. B. Bury, this alliance would explain the cause of the Bulgarian action. Vasil Zlatarski supposes that the Emperor offered the Serbs complete independence in return.

War
According to Porphyrogenitus, the Bulgars wanted to continue their conquest of the Slavic lands and to force the Serbs into subjugation. Khan Presian (r. 836–852) launched an invasion into Serbian territory in 839, which led to a war that lasted for three years, in which the Serbs were victorious. The Bulgarian army was heavily defeated and lost many men. Presian made no territorial gains and was driven out by the army of Vlastimir. The Serbs held out in their hardly accessible forests and gorges, and knew how to fight in the hills. The war ended with the death of Theophilos in 842, which released Vlastimir from his obligations to the Byzantine Empire.

According to Tibor Živković, it is possible that the Bulgarian attack came after the failed invasion of Struma and Nestos valley in 846: Presian may have collected his army and headed for Serbia, and Vlastimir may have participated in the Byzantine–Bulgarian Wars, which would mean that Presian answered to a direct Serbian involvement.

The defeat of the Bulgars, who had become one of the greater powers in the 9th century showed that Serbia was an organized state, fully capable of defending its borders; a very high military and administrative organizational frame to present such effective resistance.

Aftermath
Soon after 846, with the end of the 30–year–peace established by the Byzantine–Bulgarian Treaty of 815, Presian and his first minister Isbul invaded the regions of the Struma and the Nestos, and empress–regent Theodora (r. 842–855, the wife of Theophilos) answered by attacking Thracian Bulgaria. A brief peace was concluded, then Presian proceeded to invade Macedonia and eventually most of the region, including the city of Philippi, were incorporated in Bulgaria. The Bulgarians also imposed rule on the Morava region, the frontier region between Serbia and the Bulgarian Khanate.