The Kingdom of France () was a medieval and early modern monarchy in Western Europe. It was one of the most powerful states in Europe and a great power since the Late Middle Ages and the Hundred Years' War. It was also an early colonial power, with possessions around the world. 

France originated as West Francia ("Francia Occidentalis"), the western half of the Carolingian Empire, with the Treaty of Verdun (843). A branch of the Carolingian dynasty continued to rule until 987, when Hugh Capet was elected king and founded the Capetian dynasty. The territory remained known as "Francia" and its ruler as "rex Francorum" ("king of the Franks") well into the High Middle Ages. The first king calling himself "Roi de France" ("King of France") was Philip II, in 1190. France continued to be ruled by the Capetians and their cadet lines—the Valois and Bourbon—until the monarchy was overthrown in 1792 during the French Revolution. 

France in the Middle Ages was a de-centralised, feudal monarchy. In Brittany and Catalonia (now a part of Spain) the authority of the French king was barely felt. Lorraine and Provence were states of the Holy Roman Empire and not yet a part of France. Initially, West Frankish kings were elected by the secular and ecclesiastic magnates, but the regular coronation of the eldest son of the reigning king during his father's lifetime established the principle of male primogeniture, which became codified in the Salic law. During the Late Middle Ages, the Kings of England laid claim to the French throne, resulting in a series of conflicts known as the Hundred Years' War (1337–1453). Subsequently, France sought to extend its influence into Italy, but was defeated by Spain in the ensuing Italian Wars (1494–1559).
Which lines ruled until then?
the Valois and Bourbon