City Attorney Larry Casto, who helped save Dallas from billions of dollars in liabilities -- and a potential bankruptcy -- announced his resignation Wednesday after less than two years in the job.

Casto said in a letter he will "focus on the next chapter of my career" -- and strongly hinted that he intends to run for mayor next year.

The news shocked council members who hired Casto to be Dallas' city attorney in September 2016. One said he was "physically ill" at the news.

Casto, who previously served as the city's longtime chief lobbyist, wrote that his career with the city taught him "Dallas is capable of greatness and that it is also capable of weathering any storm and coming out stronger on the other side."

The 53-year-old Casto declined additional comment Wednesday, preferring to let his letter speak for itself.

And the two-page letter said quite a bit about the next mayoral election.

"Already people are about who should be selected to fix all the what's -- the affordable housing crisis, the transportation stalemate, homelessness, health care, public education, job creation and poverty," he said. Casto said the mayoral race "must be about who we are as a community and what we are willing to do [to] get the Dallas we want."

He also referred to his intention to create a "top-to-bottom blueprint that will challenge our entire community."

Mayor Mike Rawlings said he had "an inkling" that Casto was going to step down, but had no idea the letter was coming this soon. When asked if he thought the city attorney would run for mayor, Rawlings simply laughed and said for the moment, at least, he remains the city's top lawyer.

"I wish he would be here longer," the mayor said. "We went through some challenging times while he was city attorney, and came out the other end better for them."

North Dallas' Lee Kleinman said Casto "has built a great team and implemented many needed reforms, so I am confident that important work will continue."

Kleinman read the letter to mean Casto would try to return to City Hall in a different capacity.

"I wish him and others the best in their pursuits to become mayor of Dallas," Kleinman said.

Larry Casto (left seated), city attorney, gives a report of the standing on plans for the future of the Dallas Police and Fire pension structure to Dallas City Council in December 2016. (Nathan Hunsinger / File Photo)

Regardless of what happens next, the laconic, low-key Casto — a Texas Tech graduate who began his political life 30 years ago as chief of staff to Sweetwater rancher-turned-state Sen. Temple Dickson — will get credit for any number of things during his brief tenure as city attorney.

He opened up bidding on would-be Fair Park operators after the mayor was ready to turn the keys over to a former Hunt Oil chairman. He settled a long-standing multi-million-dollar dispute with the Sabine River Authority over the Lake Fork reservoir. He came up with a potential solution to a years-old tussle between Southwest Airlines and Delta Air Lines over gates at Dallas Love Field.

But in the end, Casto will be known as the man who potentially saved Dallas billions of dollars.

He was instrumental in finding a fix for the Dallas Police and Fire Pension System, which, two years ago, was billions of dollars in the hole and a decade away from insolvency. The city attorney served as a go-between in negotiations between Rawlings, the city manager's office, state elected officials, pension-fund managers and police and fire representatives.

At one point, Rawlings told state officials that the pension fund's seemingly imminent collapse had Dallas "potentially walking into the fan blades that look like bankruptcy." It became a national headline, as the city's bond ratings plummeted.

But the city, police and fire representatives and legislators reached an agreement on a fix in May 2017. And the $2.1-billion pension fund, to which the city will increase its annual contribution, is expected to be fully funded in the next four decades or so.

Casto had to take on other migraines when he took office, such as decades-old back pay lawsuits filed by many thousands of public safety workers. Any of them could've cost the city billions of dollars had they reached the inside of a courtroom.

But Casto helped deliver a settlement that had long proven elusive.

Dallas City Attorney Larry Casto answered questions as the Dallas city council discussed on the proposed Harold Simmons Park in August 2017 (Ashley Landis / Staff Photographer)

After failing to resolve the lawsuit issue along with the pension in the Legislature, Casto helped knock out four of the six lawsuits -- covering about 1,700 current and former first responders -- for about $62.7 million. The city said it would issue bonds to cover the bill.

Then, in May, Casto and other city officials announced that the other two lawsuits — involving some 8,700 plaintiffs — had been settled before the state Supreme Court could weigh in. The cost was $173.3 million, which was less than the plaintiffs' previous final offer, and meant no tax-rate increase for residents.

Ted Lyon, the attorney representing the public safety workers, said the settlement represented "a historic day for the city of Dallas." Casto had spent months negotiating the settlement with Lyon. But the city attorney acknowledged in May that "there were times when I thought the two sides were too far apart to reach an accord."

In a tweet Wednesday evening, North Oak Cliff council member Scott Griggs said of Casto: "We owe him so much."

On Facebook, downtown's council member Philip Kingston wrote that during his two years, Casto "assembled a record of accomplishment and integrity that makes him the best lawyer ever to have held the top spot at City Hall." He said the city attorney's resignation is "a grievous loss" for Dallas.

"I feel physically ill," Kingston wrote.

Before coming to City Hall, Casto had spent the more than two decades as the city's legislative director in Austin, where he was tasked with crafting -- and stumping for -- legislation that would benefit the city. According to his city bio, he "drafted, had introduced, and assisted in the passage of more than 80 bills relating to the delivery of municipal services."

His aw-shucks demeanor, people skills and determined nature appealed to council members after a lengthy, difficult national search to replace Warren Ernst, who retired earlier in 2016. In fact, it was a council member — former assistant city attorney Adam McGough — who asked Casto to apply for the job despite his lack of experience managing staff or litigating cases in courtrooms.

The mayor lauded Casto when he emerged as the leading contender, calling him "one of the most politically savvy city employees" he'd known.