The future king and emperor was born William Frederick Louis of Prussia ("Wilhelm Friedrich Ludwig von Preußen") in the Kronprinzenpalais in Berlin on 22 March 1797. As the second son of Louise of Mecklenburg-Strelitz and Prince Frederick William, himself son of King Frederick William II, William was not expected to ascend to the throne. His grandfather died the year he was born, at age 53, in 1797, and his father Frederick William III became king. He was educated from 1801 to 1809 by , who was also in charge of the education of William's brother, the Crown Prince Frederick William. At age twelve, his father appointed him an officer in the Prussian army. The year 1806 saw the defeat of Prussia by France and the end of the Holy Roman Empire.