Palace–fortress complex in Spain
The Castle of Villaviciosa de Odón is a palace-fortress complex found in the small town of the same name near Madrid, Spain. It is located on Madrid Avenue.
The first construction on the site was built in the 15th century by the Counts of Chinchón. On this building, in 1496 the Marquis of Moya, Andrés Cabrera y Beatriz Fernández de Bobadilla, built the first Castle. During the Revolt of the Comuneros, the captains Diego de Heredia and Antonio de Mesa, knocked down the castle in 1521. In 1583 don Diego Fernández de Cabrera y Bobadilla, third count of Chinchón, commissioned its reconstruction from the royal architect Juan de Herrera, who made one of the towers different from the others, giving the castle a more asymmetric profile. 
Two centuries later, in 1738, the King Philip V of Spain bought the county and granted the title of Count of Chinchón and ownership of the castle to his son the "infante" Luis (half-brother of Ferdinand VI of Spain). He, in turn, commissioned Ventura Rodríguez to restore the castle and gave the locality its present name, Villaviciosa de Odón. On August 17, 1758, after the death of his wife Bárbara de Braganza, Ferdinand VI moved to the fortress where he died the following year.
In 1797 María Teresa de Borbón, Countess of Chinchón, whose portrait was painted by Goya, married the prime minister Manuel Godoy, favorite of Charles IV of Spain. In 1808, having separated from the Countess, Godoy was dismissed after the Mutiny of Aranjuez, and imprisoned in this castle, which had belonged to his father-in-law.
Forestry school.
Spain's first forestry school, the "Escuela de Especial de Ingenieros de Montes", was established at the castle in the 1840s. The forestry school relocated to El Escorial in 1870, and later to the Technical University of Madrid.
Military school and later.
Following the forestry school's departure, the Castle of Villaviciosa de Odón became a military school. It was sacked and taken by both sides during the Spanish Civil War.
It now belongs to the government and houses the Archives of the Spanish Air Force.