French troops had entered Madrid in March 1808, officially on their way to Portugal. When the royal family left for Bayonne, the city understood it had been dispossessed. On 2 May the crowd attacked the convoys taking away the last infantes; the rising spread to the Puerta del Sol, where the Guard's Mameluke cavalry charged.
The repression lasted all night. Hundreds of Madrileños were shot at the Moncloa and on the Príncipe Pío hill, on the orders of a military commission chaired by Murat. Goya would paint those two days in 1814, in the diptych of the Dos de mayo and the Tres de mayo: the charge and the firing squad, fury and administrative killing.
Joseph Bonaparte entered in July, had to flee three weeks later after Dupont's capitulation at Bailén, and returned only in December, when Napoleon retook the city in person. The Chamartín decrees abolished the Inquisition, feudal dues and two thirds of the convents: real reforms, imposed by an army of occupation, and therefore rejected along with it.
King Joseph, whom the Madrileños nicknamed Pepe Botella though he hardly drank, governed a hostile capital and opened up squares — the plaza de Oriente, the plaza de Santa Ana — which also earned him the nickname of king of the squares. He left Madrid for good after Vitoria, in June 1813. The Spanish war would cost the Empire more men than the Russian campaign.