The slogan goes, "Don't Mess With Texas." But with President Barack Obama in the White House a more appropriate cry might be: "Try it and we'll sue."

The Texas attorney general's office has filed 24 lawsuits against the federal government since Obama took office — litigation that has cost the state $2.58 million and more than 14,113 hours spent by staff and state lawyers working those cases.

Many of those have resulted in defeats, including the recent high-profile lawsuits defending Texas' strict law requiring voters to show picture ID at the polls and the new state-approved voting districts that a federal appeals court ruled were discriminatory toward minorities. Those two cases alone cost more than $2 million, according to records obtained by The Associated Press using the Freedom of Information Act.

Texas Attorney General Greg Abbott said the costs are worth it, calling the litigation "a fight against the unprecedented ideology coming from the Obama administration." In an interview, he said the legal battles he wages are meant to promote industry and protect Texas jobs.

Abbott took office in 2002 and sued the federal government three times between 2004 and 2007 while fellow Republican George W. Bush was president. But the floodgates opened under Obama, with Texas suing two dozen times since 2010. Sixteen of Abbott's lawsuits challenged environmental regulations.

Critics say the cases hit Texas taxpayers twice, forcing them to foot the bill for the legal costs while often challenging federal programs that might otherwise lead to more federal money for the state through programs such as Medicaid.

"I think the ideology is coming from his side," said state Rep. Jessica Farrar, leader of the Democratic Caucus in the Texas House. "I think he needs to stop these partisan and political battles and start working on pragmatic solutions to complex problems. They're not going to go away."

Farrar noted that budget shortfalls have forced Texas to cut billions from its public schools and health programs and may spark a legislative fight over reducing public-employee pensions.

"There's not money for these things," she said, "but there's money to go toward lawsuits."

Texas has won five of Abbott's 27 cases, lost eight and had two others dismissed because the regulations or laws being challenged were lifted or repealed by Congress. The other 12 are pending.

In all, Abbott's federal cases have cost the state more than $2.8 million. That includes $1.5 million-plus in salaries for state employees working on the cases, nearly $250,000 in court costs and the travel expenses of attorney general's office personnel, and roughly $1 million for outside counsel and expert witnesses.

Attorney general's office staff and state lawyers have also spent more than 17,325 total hours working those cases. That's the same as more than eight state employees dedicating a full year of 40-hour workweeks to lawsuits against the federal government.

"We are tasked by the state Legislature to hire lawyers to defend the state of Texas and that's what we've been doing," Abbott said. "This is absolutely part of their day-to-day jobs."

Texas prevailed in three cases against the Environmental Protection Agency this year, including an appeals court ruling in August that declared too-strict EPA measures meant to reduce pollution spreading into neighboring states. All three EPA cases may yet continue, however, since the courts sent them back to the agency to modify their objections or rules.

Abbott said the cross-border pollution law would have cost the state 600 jobs: "That case alone probably pays for all of the cases combined."

But the most costly lawsuits have been defeats.

Defending the voter ID law passed last year by the GOP-controlled state Legislature accounted for 6,513 hours, more than $625,000 in state salaries, and total expenditures approaching $705,000. About another $472,000 went to outside counsel. An appeals court ruled last month that the law unfairly burdens low-income, black and Hispanic voters.

Another expensive loss was Abbott's defending of new voting district maps, also passed last year by the Legislature. Hiring expert witnesses and outside counsel cost more than $524,000, while employee salaries and office and court expenses accounted for nearly $386,600. A federal appeals court found that the maps were drawn with intent to discriminate against minority voters.

Abbott has vowed to appeal both cases to the Supreme Court. He also said he may file additional lawsuits — no matter the cost — challenging new aspects of the Obama administration's health care reform law that Texas and 12 other states unsuccessfully challenged constitutionally to the Supreme Court.

Indeed, Abbott tweeted recently that he may need a permanent parking space in front of the high court in Washington.

"It's part in jest," he said, "but there's some reality behind it also."