Maximilian I Joseph (German: Maximilian I. Joseph; 27 May 1756 – 13 October 1825) was Duke of Zweibrücken from 1795 to 1799, prince-elector of Bavaria (as Maximilian IV Joseph) from 1799 to 1806, then King of Bavaria (as Maximilian I Joseph) from 1806 to 1825. He was a member of the House of Palatinate-Birkenfeld-Zweibrücken, a branch of the House of Wittelsbach.
 Maximilian, the son of the Count Palatine Frederick Michael of Zweibrücken-Birkenfeld and Maria Francisca of Sulzbach, was born on 27 May 1756 at Schwetzingen, between Heidelberg and Mannheim.[citation needed]
 After the death of his father in 1767, he was left at first without parental supervision, since his mother had been banished from her husband's court after giving birth to a son fathered by an actor. Maximilian was carefully educated under the supervision of his uncle, Duke Christian IV of Zweibrücken, who settled him in the Hôtel des Deux-Ponts. He became Count of Rappoltstein in 1776[citation needed] and took service in 1777 as a colonel in the French Royal Army. He rose rapidly to the rank of major-general. From 1782 to 1789, he was stationed at Strasbourg. During his time at the University of Strasbourg, Klemens von Metternich, the future Austrian chancellor, was for some time accommodated by Prince Maximilian. By the outbreak of the French Revolution, Maximilian exchanged the French for the Austrian service and took part in the opening campaigns of the French Revolutionary Wars.
 On 1 April 1795, Maximilian succeeded his brother Charles II as Duke of Zweibrücken, however his duchy was entirely occupied by revolutionary France at the time. 
 On 16 February 1799, he became Elector of Bavaria and Count Palatine of the Rhine, Arch-Steward of the Empire, and Duke of Berg upon the extinction of the Palatinate-Sulzbach line at the death of Elector Charles Theodore of Bavaria. The new elector, as Maximilian IV Joseph, found the Bavarian army in abject condition on his accession to the throne: Hardly any of the units were at full strength, the Rumford uniforms were unpopular and impractical, and the troops were badly-trained. The young Prince-Elector, who had served under the Ancien Régime in France as a colonel in the Royal Deux-Ponts Regiment, made the reconstruction of the army a priority. 
 Maximilian's sympathy with France and the ideas of enlightenment at once manifested itself when he acceded to the throne of Bavaria. In the newly organized ministry, Count Max Josef von Montgelas, who, after falling into disfavour with Charles Theodore, had acted for a time as Maximilian Joseph's private secretary, was the most potent influence, wholly "enlightened" and French. Agriculture and commerce were fostered, the laws were ameliorated, a new criminal code drawn up, taxes and imposts equalized without regard to traditional privileges, while a number of religious houses were suppressed and their revenues used for educational and other useful purposes. He closed the University of Ingolstadt in May 1800 and moved it to Landshut.[citation needed]
 In foreign affairs, Maximilian Joseph's attitude was, from the German point of view, less commendable. He never had any sympathy with the growing sentiment of German nationality, and his attitude was dictated by wholly dynastic, or at least Bavarian, considerations. Until 1813, he was the most faithful of Napoleon's German allies, the relationship cemented by the marriage of his eldest daughter to Eugène de Beauharnais. His reward came with the Treaty of Pressburg (26 December 1805), by the terms of which he was to receive the royal title and important territorial acquisitions in Swabia and Franconia to round off his kingdom. He assumed the title of king on 1 January 1806. On 15 March, he ceded the Duchy of Berg to Napoleon's brother-in-law Joachim Murat.[citation needed] After the War of the Fifth Coalition in 1809 he received Tyrol and Innviertel regions from the defeated Austria.
 The new King of Bavaria was the most important of the princes belonging to the Confederation of the Rhine, and remained Napoleon's ally until the eve of the Battle of Leipzig, when by the Treaty of Ried (8 October 1813) he made the guarantee of the integrity of his kingdom the price of his joining the Allies. On 14 October, Bavaria made a formal declaration of war against Napoleonic France. The treaty was passionately backed by Crown Prince Ludwig and by Marshal von Wrede.[citation needed]
 By the first Treaty of Paris (3 June 1814), however, he returned Tyrol to Austria in exchange for the former Grand Duchy of Würzburg. At the Congress of Vienna, which he attended in person, Maximilian had to make further concessions to Austria, ceding Salzburg and the regions of Innviertel and Hausruckviertel[citation needed] in return for the western part of the old Palatinate. The king fought hard to maintain the contiguity of the Bavarian territories as guaranteed at Ried but the most he could obtain was an assurance from Metternich in the matter of the Baden succession, in which he was also doomed to be disappointed.
 At Vienna and afterwards Maximilian sturdily opposed any reconstitution of Germany which should endanger the independence of Bavaria, and it was his insistence on the principle of full sovereignty being left to the German reigning princes that largely contributed to the loose and weak organization of the new German Confederation. The Federative Constitution of Germany (8 June 1815) of the Congress of Vienna was proclaimed in Bavaria, not as a law but as an international treaty. It was partly to secure popular support in his resistance to any interference of the Federal diet in the internal affairs of Bavaria, partly to give unity to his somewhat heterogeneous territories, that Maximilian on 26 May 1818 granted a liberal constitution to his people. Montgelas, who had opposed this concession, had fallen in the previous year, and Maximilian had also reversed his ecclesiastical policy, signing on 24 October 1817 a concordat with Rome by which the powers of the clergy, largely curtailed under Montgelas's administration, were restored.
 The new parliament proved to be more independent than he had anticipated and in 1819 Maximilian resorted to appealing to the powers against his own creation; but his Bavarian "particularism" and his genuine popular sympathies prevented him from allowing the Carlsbad Decrees to be strictly enforced within his dominions. The suspects arrested by order of the Mainz Commission he was accustomed to examine himself, with the result that in many cases the whole proceedings were quashed, and in not a few the accused dismissed with a present of money.
 Maximilian died at Nymphenburg Palace, in Munich,[citation needed] on 13 October 1825 and was succeeded by his son Ludwig I. Maximilian is buried in the crypt of the Theatine Church in Munich.
 Under the reign of Maximilian Joseph the Bavarian Secularization (1802–1803) led to the nationalisation of cultural assets of the Church. The Protestants were emancipated. In 1808 he founded the Academy of Fine Arts Munich.[citation needed]
 The city of Munich was extended by the first systematic expansion with the new Brienner Strasse as core. In 1810 Max Joseph ordered construction of the National Theatre Munich in French neo-classic style. The monument Max-Joseph Denkmal before the National Theatre was created in the middle of the square Max-Joseph-Platz as a memorial for King Maximilian Joseph by Christian Daniel Rauch and carried out by Johann Baptist Stiglmaier. It was only revealed in 1835 since the king had rejected to be eternalized in sitting position.[citation needed]
 In 1801 he led the rescue operation when a glassmaker's workshop collapsed, saving the life of Joseph von Fraunhofer, a 14-year-old orphan apprentice. Max Joseph donated books and directed the glassmaker to give Fraunhofer time to study. Fraunhofer went on to become one of the most famous optical scientists and artisans in history, inventing the spectroscope and spectroscopy, making Bavaria noted for fine optics, and joining the nobility before his death at age 39.[citation needed]
 He was elected a Royal Fellow of the Royal Society in 1802.
 As a monarch, Max Joseph was very close to the citizens, walked freely along the streets of Munich without great accompaniment, and conversed with his people in a casual manner. Regardless, he was somewhat eccentric, like some of his descendants and successors. Maximilian married twice and had children by both marriages:
 His first wife was Princess Augusta Wilhelmine of Hesse-Darmstadt, daughter of Prince George William of Hesse-Darmstadt (14 April 1765 – 30 March 1796). They were married on 30 September 1785 in Darmstadt. They had five children:
 Maximilian's second wife was Karoline of Baden, daughter of Margrave Karl Ludwig of Baden (13 July 1776 – 13 November 1841). They were married on 9 March 1797 in Karlsruhe.[citation needed] They had eight children,[citation needed] including two sets of twin girls, Elisabeth and Amalie born in 1801, and Sophie and Marie Anne born in 1805.