In 1409 a hospital was founded and placed under the patronage of Santa María de los Innocentes; to this was attached a confraternity devoted to recovering the bodies of the unfriended dead in the city and within a radius of three miles around it. At the end of the 15th century this confraternity separated from the hospital, and continued this work under the name of "Cofradía para el amparo de los desamparados". King Philip IV and the Duke of Arcos suggested the building of the new chapel, and in 1647 the Viceroy Conde de Orpesa, who had been preserved from the bubonic plague, insisted on carrying out their project. The Blessed Virgin under the title of "Virgen de los desamparados" was proclaimed patroness of the city, and Archbishop Pedro de Urbina y Montoya, on 31 June 1652, laid the cornerstone of the new chapel of this name.