In 1187, the city was wrested from the Crusaders by Saladin who permitted Jews and Muslims to return and settle in the city. Under the terms of surrender, once ransomed, 60,000 Franks were expelled. The Eastern Christian populace was permitted to stay. Under the Ayyubid dynasty of Saladin, a period of huge investment began in the construction of houses, markets, public baths, and pilgrim hostels as well as the establishment of religious endowments. However, for most of the 13th century, Jerusalem declined to the status of a village due to city's fall of strategic value and Ayyubid internecine struggles.