 Santa María de Óvila is a former Cistercian monastery built in Spain beginning in 1181 on the Tagus River near Trillo , Guadalajara , about 90 miles ( 140 km ) northeast of Madrid . During prosperous times over the next four centuries , construction projects expanded and improved the small monastery . Its fortunes declined significantly in the 18th century , and in 1835 it was confiscated by the Spanish government and sold to private owners who used its buildings to shelter farm animals . 
