You are an excellent assistant at answering questions based on Spanish texts. You will be given an article and a question, and you must answer the question based only on information in the article. The response should be extracted from the context verbatim.

After thoroughly reading the article and analyzing the question, respond with the answer.

Title:
East_Prussia

Context:
After the disastrous defeat of the Prussian Army at the Battle of Jena-Auerstedt in 1806, Napoleon occupied Berlin and had the officials of the Prussian General Directory swear an oath of allegiance to him, while King Frederick William III and his consort Louise fled via Königsberg and the Curonian Spit to Memel. The French troops immediately took up pursuit but were delayed in the Battle of Eylau on 9 February 1807 by an East Prussian contingent under General Anton Wilhelm von L'Estocq. Napoleon had to stay at the Finckenstein Palace, but in May, after a siege of 75 days, his troops led by Marshal François Joseph Lefebvre were able to capture the city Danzig, which had been tenaciously defended by General Count Friedrich Adolf von Kalkreuth. On 14 June, Napoleon ended the War of the Fourth Coalition with his victory at the Battle of Friedland. Frederick William and Queen Louise met with Napoleon for peace negotiations, and on 9 July the Prussian king signed the Treaty of Tilsit.

Question:
What defeat led to Prussia having to swear its allegiance to Napoleon?

Battle of Jena-Auerstedt