The history of the museum began in 1803 when the royal military museum was established in a building in Madrid known as the Palacio de Monteleón. The building also served as a barracks for artillery units and it was attacked and looted by the French when they suppressed the Dos de Mayo Uprising of 1808. The museum was reestablished, but in 1827 it was divided into two sections: the Museo de Artillería and the Museo de Ingenieros. Later the collections were unified and housed in the Hall of Realms.