On its own, Samarra had little to incentivize residents to stay; the water supply was problematic and the city seems to have been heavily dependent on supplies from elsewhere. As long as the caliphs were willing to pour vast sums of money into the city, it continued to survive; with the return of the caliphs to Baghdad, this investment dried up and soon much of the city was abandoned. In the following centuries, a few isolated settlements survived within the ruins, but the vast portion of the city soon became uninhabited.