The Battle of the Gates of Trajan (Bulgarian: , Medieval Greek: ) was a battle between Byzantine and Bulgarian forces in the year 986.
It took place in the pass of the same name, modern Trayanovi Vrata, in Sofia Province, Bulgaria. It was the largest defeat of the Byzantines under Emperor Basil II. After the unsuccessful siege of Sofia he retreated to Thrace, but was surrounded by the Bulgarian army under the command of Samuil in the Sredna Gora mountains. The Byzantine army was annihilated and Basil himself barely escaped.
Fifteen years after the fall and the capture of Bulgarian capital Preslav, the victory at the Gates of Trajan extended the Bulgarian successes achieved since 976. Later on Tsar Samuil moved the capital from Preslav in the northeast to Ohrid in the southwest. The memory of the great victory over Basil II was preserved thirty years later in the Bitola inscription of Ivan Vladislav (10151018), the son of Aron.
The Byzantine–Bulgarian wars were a series of conflicts fought between the Byzantines and Bulgarians which began when the Bulgars first settled in the Balkan peninsula in the 5th century, and intensified with the expansion of the Bulgarian Empire to the southwest after 680 AD. The Byzantines and Bulgarians continued to clash over the next century with variable success, until the Bulgarians, led by Krum, inflicted a series of crushing defeats on the Byzantines. After Krum died in 814, his son Omurtag negotiated a thirty-year peace treaty. Simeon I, who ruled Bulgaria from 893 to 927 had multiple successful campaigns against the Byzantines. His son Peter I negotiated another long-lasting peace treaty. His rule was followed by a period of decline of the Bulgarian state.
In 971 John I Tzimiskes, the Byzantine emperor, subjugated much of the weakening Bulgarian Empire, facing wars with Russians, Pechenegs, Magyars and Croatians and by defeating Boris II and capturing Preslav, the Bulgarian capital. Samuel managed to stabilize the Bulgarian state with a center around the town of Prespa but at the end of his rule, the Byzantines got the upper hand again. Constantinople under Basil II completely conquered Bulgaria in 1018 as a result of the 1014 Battle of Kleidion. There were rebellions against Byzantine rule from 1040 to 1041, and in the 1070s and the 1080s, but these failed. In 1185, however, Theodore Peter and Ivan Asen started a revolt, and the weakening Byzantine Empire, facing internal dynastic troubles of its own, was unable to prevent the revolt from being successful.
After the Fourth Crusade conquered Constantinople in 1204, Kaloyan, the Bulgarian emperor, tried to establish friendly relations with the crusaders, but the newly created Latin Empire spurned any offer of alliance with the Bulgarians. Because of his cold reception, Kaloyan allied with the Nicaeans, one of the Byzantine states created after the fall of Constantinople, instead, which reduced the crusaders' power in the area. Even though his nephew Boril allied with the Latin Empire, Boril's successors sided with the Nicaeans, despite a few continuing attacks from them. After the Latin Empire collapsed, the Byzantines, taking advantage of a Bulgarian civil war, captured portions of Thrace, but the Bulgarian emperor Theodore Svetoslav retook these lands. The Byzantine-Bulgarian relations continued to fluctuate until the Ottoman Turks captured the Bulgarian capital in 1393 and the Byzantine capital in 1453.