Natwar M. Gandhi, the District’s chief financial officer who ushered the city out of a dismal period of financial uncertainty and into an era of growth and stability, announced his resignation Friday, less than a year after he sought and received a third term.

Gandhi had earned the trust of Wall Street and Capitol Hill, and just this week he announced a $417 million budget surplus. But his stewardship of city finances has come under scrutiny, including after an embezzlement scheme by employees that siphoned nearly $50 million from city coffers.

Most recently, he has been battered by a string of controversies involving his office’s decision to lower some commercial property tax assessments by $2.6 billion and his policy to keep internal audits private, which were revealed by The Washington Post and are now the subjects of two federal investigations.

“Though I look forward to the next chapter in my life, this was not an easy decision,” Gandhi wrote in his resignation letter Friday to Mayor Vincent C. Gray (D). He thanked Gray and the previous mayors who appointed him — Anthony A. Williams and Adrian M. Fenty — “for giving me the opportunity to participate in the District’s financial rejuvenation and to serve the residents of this great city.”

Gandhi, who has held the office since 2000, said he will retire June 1.

D.C. deficits and surpluses

David Umansky, a spokesman for Gandhi, said the resignation was “entirely for purely personal reasons.” He declined to elaborate.

In notifying some city officials ahead of Friday’s announcement, Gandhi — a 72-year-old grandfather who was widowed in 2011 — cited a burgeoning relationship with a Philadelphia woman with whom he went to India recently.

The trip “was a very sincere, soulful experience,” said one person who requested anonymity because he was not authorized to speak about the conversation. “I think he just felt like this was a sign that it was time to move on.”

On Tuesday, Gandhi joined Gray in announcing the results of the District’s annual financial audit. The audit confirmed the budget surplus, which will push city budget reserves to $1.5 billion, the second-highest level in city government history.

“This is truly a financial renaissance, a reformation, that belongs in the municipal annals,” Gandhi said, alluding to the half-billion dollar deficits that led Congress to take control of the city from 1995 through 2001.

“We are in exceptionally good condition. We are viewed very favorably on Wall Street, and when we go back again in February, we will go with our heads held high, saying we come from a city on a hill,” he said.

But the past year has been among Gandhi’s most difficult — rivaled only by the 2007 revelation that mid-level employee Harriette Walters had orchestrated a $50 million theft from the city tax office.

Most recently, questions have emerged over his handling of internal audits that outlined problems throughout his agency. One of them, obtained by The Post last year, described a “significantly flawed” system in which tax supervisors could access property records and alter them without being detected. Gandhi, who as CFO oversees the tax office, defended keeping the internal audits private, but the D.C. Council approved legislation that requires such reports to be shared with city officials and the public in a timely manner.

Subsequently, the Securities and Exchange Commission launched an inquiry into the handling of the internal audits. The FBI had previously looked into the tax office’s handling of property tax assessments, according to several people familiar with the investigation.

Even before the assessments controversy erupted, Gandhi had been under fire over his office’s handling of a lucrative contract to operate D.C. Lottery’s numbers games, dating to 2008. Gandhi remains the subject of a federal lawsuit brought by his former contracting director, who alleges that he was fired in response to political pressure from D.C. Council members.

Marie Drissel, a Kalorama civic activist who served in the Williams administration, said that Gandhi “lost interest in the details” of managing key office functions as his tenure wore on, focusing instead on maintaining relations with Wall Street and the politicians whose support he cultivated.

“He just stopped,” Drissel said. “CFOs need to be junkyard dogs, and they can’t stop.”

Gray waited until Gandhi’s last term had nearly expired before announcing in June that he would reappoint him. The council confirmed Gandhi for a third full five-year term the next month. In September, he threw himself a wine-and-cheese reception at the private Metropolitan Club to celebrate his reappointment.

In an interview with The Post the day before he traveled to India in December, Gandhi said he had no plans to resign, although he acknowledged the toll that the job had taken on him. “People like me come and go,” he said. “I have no illusion. Even though I have a five-year tenure, and I have spent 12 years here and four mayors, God, I take one day at a time. You cannot take these things for granted here.”

Jim Dinegar, chief executive of the Greater Washington Board of Trade, said he was not especially surprised that Gandhi is leaving — particularly given this week’s surplus announcement.

“I guess if I’m in his shoes, it’s, ‘Here’s a $400 million surplus — thank you very much, don’t forget to tip your waitress,’ ” he said.

But several people said the week appeared normal for Gandhi, a native of Gujarat, India, who has moonlighted as an author of Sanskrit poetry and an actor who has portrayed Mahatma Gandhi.

Council member Jack Evans (D-Ward 2), chairman of the Finance and Revenue Committee, said Gandhi walked into his office about 10 a.m. Friday and said he “wanted to take it easy, spend time with his friend doing poetry, and has no plans to take another job.” Gandhi would be open to sitting on a corporate board, according to Evans.

Evans said that there “is tremendous concern” among city and business leaders about “who’s next” but that he is optimistic Gray will conduct an inclusive, nationwide search for Gandhi’s replacement.

Gray — who despite occasional disagreements with Gandhi developed a rapport over their commitment to fiscal rectitude — said in a statement he was “sorry to see him go.”

“Without his leadership, the District would not have experienced the extraordinary fiscal turnaround that we have seen in the last dozen years,” Gray said. “Our city owes him a great debt of gratitude.”

Gray’s spokesman, Pedro Ribeiro, said it was “too soon” to discuss a replacement. Others in the John A. Wilson Building were not so reticent.

“We need someone with enormous skills,” said Evans, noting that the council needs to confirm a nominee before Gandhi’s scheduled departure date.

Council member David A. Catania (I-At Large), Gandhi’s most frequent critic on the council, said that Gray and other District officials need to aggressively recruit a replacement.

“There was a time when we would put a help-wanted sign out and pick from the people who showed, but I think the city has to be more self-respecting,” Catania said. “We need to go after people who are excellent, who are demonstrated leaders . . .

Last year, Catania was the only council member to vote against Gandhi’s reappointment, expressing doubt about his revenue projections and truthfulness. But in an interview Friday, Catania said Gandhi will likely be remembered as an effective public servant who helped stabilize city finances.

“People generally forget the bad over time,” Catania said. “I think Dr. Gandhi’s tenure will be one that is generally seen as a net plus for the city, and I think he deserves that.”

Debbie Cenziper and Tim Craig contributed to this report.