The District’s chief financial officer has warned Mayor Adrian Fenty and D.C. Council Chairman Vince Gray that the city’s A1 credit rating is in danger after the purchase of a troubled hospital and heavy losses to the general fund.

Natwar Gandhi’s warning came in the form of a letter he wrote to the city’s two top elected officials following a meeting he had with the three major rating agencies.

Gandhi has repeatedly warned elected officials not to buy United Medical Center. But with the only hospital on the east side of the Anacostia River teetering on the brink of insolvency, the mayor and council moved quickly to buy the hospital and set up a nonprofit organization to run it.

According to the letter, one analyst told Gandhi, “We are very sensitive to enterprise risk, especially hospitals. Governments are not used to running hospitals.”

Meanwhile, the Fenty administration has drawn down the city’s general fund balance nearly 40 percent in the last two years. In fiscal 2007, the fund carried a balance of $1.5 billion. By the close of fiscal 2009, it was down to $920 million.

“To fail to address these challenges effectively would clearly threaten the District’s hard-earned bond ratings, and could be viewed very unfavorably by rating agencies and investors alike,” Gandhi warned.