The Principality of Nitra (Slovak: Nitrianske kniežatstvo, Nitriansko) also known as the Duchy of Nitra, was a Slavic polity encompassing a group of settlements that developed in the 9th century around Nitra in present-day Slovakia. Its history remains uncertain because of a lack of contemporary sources. The territory's status is subject to scholarly debate; some modern historians describe it as an independent polity that was annexed either around 833 or 870 by the Principality of Moravia while others say that it was under influence of the neighbouring Slavs from Moravia from its inception.
Modern-day Slovakia was dominated for centuries by Germanic peoples, including the Quadi and the Longobards or Lombards, who were there until the middle of the 6th century. A new material culture characterized by handmade pottery, cremation burials and small, square, sunken huts that typically featured a corner stone oven appeared in the plains along the Middle Danube around that time. The new culture, with its "spartan and egalitarian" nature, sharply differed from the earlier archaeological cultures of Central Europe. According to Barford, a report by the Byzantine historian Procopius is the first certain reference to Early Slav groups inhabiting parts of present-day Slovakia. Procopius wrote that an exiled Lombard prince named Hildigis mustered an army, "taking with him not only those of the Lombards who had followed him, but also many of the Sclaveni" in the 540s.
The nomadic Avars, who arrived from the Eurasian steppes, invaded the Carpathian Basin and subjected the local inhabitants in the second half of the 6th century. Thereafter, Slavic groups inhabiting areas around the core regions of the Avar Khaganate paid tribute to the Avars. The khaganate experienced a series of internal conflicts in the 630s. According to the Chronicle of Fredegar, the "Slavs who are known as Wends" rebelled against the Avars and elected a Frankish trader named Samo as their king in the early 7th century. Samo's realm, which emerged in the northern or northwestern regions of the Carpathian Basin, existed for more than three decades. It disintegrated soon after its founder's death and Avar control of the region was restored.