The Duchy of Prussia had its origin in the establishment of the Germans in East Prussia from the 12th century. The last grand master of the order, Albert of Brandenburg-Ansbach, swore allegiance to the king of Poland, Sigismund the Elder. For his part, the Polish monarch secularized the territories of the Teutonic Order and handed them to Albert for him and his heirs in the form of the Duchy of Prussia.
After a long series of interfamiliar marriages, Brandenburg and Prussia were in a personal union that would last more than 300 years and that initially would be known under the duality Brandenburg-Prussia.
However, and despite the fact that the Brandenburg Hohenzollerns managed to obtain significant territorial gains thanks to strategic marriages, they were not in a position to assert their authority if their military force was put to the test. The Thirty Years War was a disaster for Brandenburg, which was occupied successively by the sides in conflict. Instead, Prussia was left out of the battlefields and served as a refuge for the Margrave. Despite this, at the end of the war in 1648, Brandenburg-Prussia received the eastern part of Pomerania.
Although the Peace of Westphalia awarded Brandenburg territorially, as in 1618, the Hohenzollerns were not in a position to defend their acquisitions. To counteract this weakness, the Elector of Brandenburg began to strengthen the army, reaching 25,000 troops in 1655, enough to play an important role in the Battle of Warsaw as an ally of Sweden against Poland. Frederik William was then able to obtain the guarantee of King Charles X Gustav of Sweden that he would not try to snatch Prussia from him, in exchange for swearing vassalage to him. However, as soon as the Swedish army withdrew to the north to fight against Denmark, the Elector changed sides and allied with the Polish king. In this way, the army of Frederick William led the attack of the Austro-Polish-Brandenburg coalition against Sweden, achieving a decisive victory. Brandenburg-Prussia was thus able to control all of Pomerania, but despite its growing military importance, it remained a minor power in international politics. The international recognition of the Brandenburg dominion over Prussia was then the only gain that the Hohenzollern could draw from the Northern War of 1655-1660.
Frederick William, the "Grand Elector" of Brandenburg-Prussia, died in 1688. His estates passed to his son Frederick III (1688-1701), who became King Frederick I of Prussia (1701-1713). With the exception of the Duchy of Prussia, all the lands of Brandenburg were part of the Holy Roman Empire, at that time under the hereditary government of the House of Habsburg. Frederick III obtained the consent of Emperor Leopold I, in exchange for the alliance against France in the war of Spanish Succession, to adopt the title of "King in Prussia" based on their not imperial territories.
The new Kingdom of Prussia was very poor. In 1708, approximately one third of the population of the Duchy of Prussia was affected by the bubonic plague. The plague reached Prenzlau in August 1710, but disappeared before reaching the capital, Berlin, only 80 km away.
The defeat of the Swedes in the Great Northern War (1700-1721) marked the end of Swedish rule on the southern shore of the Baltic Sea. In the Prussian-Swedish Stockholm Treaty (January 1720), Prussia recovered Stettin and other parts of the Swedish possessions in Pomerania.
In 1740 Frederick II the Great took the throne and invaded Silesia, which marked the beginning of the War of the Austrian Succession. Frederik got the formal transfer with the Berlin Treaty of 1742.
Austria managed to nullify Prussia's advantage in the war. In 1744, Frederick invaded regions of the Empire to avoid reprisals and claim the province of Bohemia. It was unsuccessful, but the French pressure on Britain, ally of Austria, led to a series of treaties and agreements that culminated in 1748 with the signing of the Treaty of Aachen, which restored peace and granted to Prussia most of the territory of Silesia.
After that, Austria sought a secure alliance with France and Russia, while Prussia tried to approach Britain. When Frederick invaded Saxony and Bohemia in 1756-1757, the Seven Years' War began.
The way Prussia led the war caused great respect in Europe for the skills of Frederick's army, as it managed to avoid major invasions until October 1760, when the Russian army occupied Berlin and Königsberg. But the accession to the Russian throne of Prussian supporter Peter III relieved the pressure on the eastern front. Sweden also left the war then.
By defeating the Austrian army at the Battle of Kunersdorf, Prussia was, at last, capable of forcing a status quo ante bellum on the continent. This result confirmed the main role of Prussia in the German states and consolidated it as a great European power.