The Franciscan monastery named after Saint John the Evangelist was already standing around 1270 at the southeastern part of Buda town, immediately next to the eastern wall. The significance of the monastery is well indicated by the fact that Andrew III, the last king of the Árpád dynasty was buried in this church, and also that King Louis the Great made a donation for the monastery's expansion. Most probably from the early beginnings a theological school had operated in the monastery. As a result of the Franciscan reform movements that took place during the 15th century, the order was taken over by the stricter Salvadorians in 1444, and Saint John monastery became the Order's Chief Monastery. In 1526 and 1529 it was raided by Turkish troops. Following the occupation of Buda by the Turks in 1541, the monastery's church was turned into a djami. The monastery's significance as a djami increased at the turn of the 16th and 17th centuries, when the seraglio (palace) of the pashas of Buda was built on the area located north of the monastery. From this point onwards it was referred to as the Pasha or Seraglio Djami. After Turkish rule came to an end, the church and the living quarters south from the church (monastery-square) survived, albeit in a ruined condition. Following the re-occupation, the church and the area north of the church was first given to the Jesuits and then to the Carmelite Order. The Carmelites demolished the standing church walls and used them up as the foundation walls of the new Baroque style church they built. Right after the re-occupation, a military building was constructed over the ruins of the former monastery, and later at the beginning of the 19th century it was replaced by the Sándor Mansion. The foundation walls of the medieval church were unearthed in the 1970's beneath the Castle Theatre, while the monastery wings were excavated between 1994 and 2001 beneath the Sándor Mansion.