It’s almost unimaginable now, but one of Barack Obama’s first official acts as president was to throw a White House party for the nation’s governors.

The black-tie gala, a month after Obama moved to Pennsylvania Avenue, featured all the pomp and circumstance of a dinner to honor a foreign head of state. Fashion watchers marveled at First Lady Michelle Obama’s charcoal strapless gown embellished with crystals. After dinner, the band Earth, Wind and Fire entertained.

The governors, a majority of them Democrats like Obama, relished the moment. Montana Gov. Brian Schweitzer, a Democrat with a well-known penchant for blue jeans, sported a suit and tie. California Gov. Arnold Schwarzenegger, a Republican, shared laughs with the First Lady. And Florida Gov. Charlie Crist, then a Republican as well, joked that a few of his GOP comrades were giving him a hard time for backing Obama’s stimulus package. The party lasted well into the night.

The president -- wearing a trim tuxedo, a U.S. flag lapel pin and a head of hair virtually untouched by gray -- raised a toast to the governors. “Nobody understands what’s happening in the country, and the struggles, hopes, hardships and the dreams of the American people as well as the nation’s governors,” Obama said. “I want you to know that despite our occasional differences, my hope is that we can all work together.”

It was not to be.

The following year’s midterm elections swept Republicans into power in 29 state legislatures, with most of the winners campaigning against the Obama administration and its policies. Within months of that election, conservative attorneys general unleashed a broadside of lawsuits against the administration on immigration, health-care and air pollution rules. Obama’s Justice Department hauled states into court over immigration and voting rights. Wisconsin Gov. Scott Walker pulled the plug on a high-speed rail route the president wanted, and Obama blasted Walker for weakening unions. Tea Party activists accused the administration of flouting 10th Amendment guarantees of states’ rights, and the governor of Texas joked publicly about secession. A Democratic governor and a Republican governor argued in the presence of reporters in the White House driveway, and Arizona’s GOP governor poked Obama with an accusatory finger in front of Air Force One. Relations between the White House and the states had broken down quickly and thoroughly.

It’s clear now that the Obama years will be remembered as a time when states and the federal government were rarely partners, as Obama had envisioned, but mostly adversaries. But these years might also be remembered as a time when an administration seemingly hobbled by opposition in Congress and in the states regained its footing through executive actions and the pursuit of new partners. It’s a shift that could have long-lasting lessons for governing in an era of divided politics.

It’s also a shift that Obama never intended. From the very beginning, Obama tried to make sure the federal government wasn’t going it alone on his major legislative initiatives. As president-elect, Obama invited the National Governors Association to a special meeting at Philadelphia’s Independence Hall to discuss his plans for an economic stimulus package that would turn around the cratering economy. “I’m not simply asking the nation’s governors to help implement our economic plan,” he said to the assembled governors. “I’m going to be interested in having you helping draft and shape that economic plan.”

The meeting felt like a “bit of a homecoming,” the president told the audience, because only four years earlier, he had been a state senator in Illinois. But, as both Obama and the governors knew, a president’s experience in state government was no guarantee that his administration would work well with states. Obama’s predecessor, President George W. Bush, was a former governor in Texas. Still, state relations with the federal government had deteriorated significantly under Bush.

During the Bush years, Congress made states foot part of the bill for a Medicare prescription drug benefit, imposed strict rules for failing schools under No Child Left Behind and mandated that states make costly security improvements to their driver’s licenses under the Real ID law. By one count, Bush signed more than two dozen federal laws that preempted state initiatives, while agencies under his control blocked states from taking action on the regulation of banking, greenhouse gas emissions and drug labels.

In both show and substance, Obama worked to repair those relationships. He issued an executive order in May 2009 discouraging federal agencies from enacting regulations that would preempt state laws. That same month, he welcomed the governors of California and Michigan to the Rose Garden as he announced that the Environmental Protection Agency would permit California to limit gas emissions by vehicles, a move the Bush administration had tried to block. The president recruited governors to head the departments of Agriculture, Commerce, Homeland Security, and Health and Human Services, and chose a Republican governor as his ambassador to China. State officials were named to head the Environmental Protection Agency and the Federal Emergency Management Agency.

But the biggest initial changes came through the 2009 stimulus package, formally called the American Recovery and Reinvestment Act. More than a third of the spending under the law, originally pegged at $787 billion, went to or through state government. The stimulus provided a lifeline for states awash in red ink following the recession, primarily by giving them money for Medicaid and schools. The law offered additional funds to help states extend unemployment benefits, and helped pay for infrastructure improvements that included broadband, high-speed rail, bridge repairs and road repaving.

Still, by the time of the White House gala, six of the 22 Republican governors had announced they would not accept stimulus money for unemployment benefits, because they worried that they would have to raise business taxes to pay for the expanded benefits after federal money ran out. The resistance, small as it was, was one of the first bumps in the road for the new administration. Obama was clearly frustrated when he talked to governors at a business meeting the morning after their dinner. “If we agree on 90 percent of this stuff, and we’re spending all of our time on television arguing about 1, 2, 3 percent [of it], that starts to sound a little like politics,” he told them.

The crop of GOP governors elected in 2010 wasted no time in expressing their hostility toward Obama and other Democrats. In his campaign, Wisconsin’s Walker pilloried the incumbent Democrat for a planned high-speed rail route between Milwaukee and Madison, which would be paid for under Obama’s stimulus plan, because the state would eventually have to pay for the operating costs. When Walker took office, he promptly pulled the plug on the project. Newly elected governors in Florida and Ohio did the same to projects in their states.

On the other hand, the stimulus package demonstrated that a light touch could lead to big results at the state and local level, even without the partnership Obama originally envisioned. The best-known example was Race to the Top, a contest among states to get a share of $4.35 billion in federal school funding. The catch was that, to stand a good chance of getting this money, states had to adopt education policies that the Obama administration backed, such as expanding charter schools, linking teacher and principal evaluations to student performance, and adopting common curriculums. All told, 19 states would eventually win money in the competition, but 34 states changed their education policies to compete for it. The contest also spurred the widespread adoption of the Common Core State Standards, which were developed by the National Governors Association and state school officers.

The administration took a similar approach to transportation. The stimulus law created a pool of money for what became known as Transportation Investment Generating Economic Recovery (TIGER) grants to pay for large transportation projects, selected for the economic benefits they would bring to their region. The grants proved so popular -- and oversubscribed -- that Congress has repeatedly set aside more money for them, and they continue to this day.

The stimulus marked the first time since President Lyndon Johnson’s Great Society, which included contests for municipalities to distinguish themselves as “model cities,” that a president had used state and local competitions so extensively. The Obama administration would return to them time and time again.

Productive as those strategies were, they did less to redefine the state-federal relationship for the long term than the Affordable Care Act, which relies heavily on states to carry out its goal of expanding health coverage. As the law was originally written, states would have been required to expand their Medicaid eligibility to include residents who could not qualify for newly created state insurance exchanges. The federal government would have picked up the entire initial bill for this expansion, while gradually reducing its level of funding. But the U.S. Supreme Court blew a hole in that plan in 2012 by making Medicaid expansion optional for states, rather than mandatory, while keeping the rest of the law intact.

The Supreme Court’s decision added to public confrontations between the Obama administration and the Republicans, with both sides claiming victory. Behind the scenes, however, the ruling forced both sides to the table to negotiate the terms of Medicaid expansion, often reaching a middle ground far different from either side’s public stance. Both sides had an incentive to strike a deal: States could save money, and the Obama administration could cut down on the number of people without insurance.

“The federal dependence on the states has only grown,” says Gillian Metzger, a Columbia Law School professor who studies federalism. “It has brought more bipartisanship into the implementation of these programs than might otherwise exist.” For example, the Obama administration made concessions to Republican governors on Medicaid expansion that allow states to charge recipients monthly premiums, bill patients for improper emergency room use and contract with private insurers to deliver the expanded coverage.

Something similar has happened in a few other areas. In education, the Obama administration negotiated waivers with individual states allowing them to escape from many of the strictures of the Bush administration’s No Child Left Behind law. Over time, the agreements between states and the U.S. Department of Education formed the basis for a congressional overhaul of that law. When it comes to decriminalizing or legalizing marijuana, the federal government has taken a back seat to state officials in Colorado and Washington, where voters have approved recreational use of the drug. The administration has not agreed to push for changes to federal laws that ban marijuana, but it has chosen not to prosecute marijuana retailers in these states. The Justice Department discouraged the Supreme Court from getting involved in a lawsuit Nebraska and Oklahoma filed against Colorado over the marijuana legalization.

On air pollution, the administration is relying on an Obamacare-like regulatory scheme to push states into reducing carbon dioxide emissions from power plants: Either the states develop a plan, or the feds will do it for them. But the targets that each state must meet under the Clean Power Plan all call for additional reductions, no matter how much states have already done. In effect, the Obama administration is banking on state policies that are already in place, and then asking for more.

This is in line with the administration’s overall philosophy on regulation. The federal government sets the floor, or the minimum action a state must take, but states are generally free to go further. That stands in contrast with the Bush administration, which used regulations as ceilings on state action. This allowed the Republican-controlled White House to impose uniform standards throughout the country, a move often welcomed by businesses that didn’t want to have to comply with 50 different sets of regulations. The Bush administration blocked California’s effort to curb air pollution by requiring more fuel-efficient vehicles; the Obama administration welcomed it.

The declining number of Democratic governors during Obama's administration has given the president fewer allies in the states. (AP)

Even though states and the Obama administration occasionally find common ground, their relationship, particularly in Republican-led states, is still marred by hostility and frustration. Both sides have ratcheted up the conflict.

“The Obama administration’s policies are almost without exception designed to move power away from the states into the federal government,” says former Mississippi Gov. Haley Barbour, a Republican Party insider who was governor during the first three years of the Obama administration.

Even in areas where the federal government says it’s giving flexibility to the states, it’s sometimes forcing states to do things they don’t want to do. Under the Affordable Care Act, the Supreme Court said the law effectively put “a gun to the head” of states by requiring them to expand Medicaid or risk losing all of their federal Medicaid funding. Likewise, Barbour says, the Clean Power Plan imposes the federal will on states. “States are forced to change their policies,” he says. “If states think they have good energy policy, or a good electric utility policy, the Clean Power Plan doesn’t allow them to keep that.”

On many issues, the Obama administration has jealously guarded federal powers -- and discouraged freelancing from states and local governments. That’s particularly true on immigration. Most famously, the administration successfully challenged a sweeping Arizona law designed to curb illegal immigration to the state, saying that Arizona could not take enforcement of federal immigration policy into its own hands. After the Supreme Court largely agreed, courts blocked similar bills that several other states had passed. Obama also scaled back federal programs, developed under Bush, that enlisted local police in enforcing immigration law. But to the consternation of the president’s liberal supporters, Obama also insisted that federal Immigration and Customs Enforcement agents should be able to take criminal suspects directly from local jails if they are suspected of immigration violations.

The president pushed the rivalry with Republicans further with two sets of executive actions designed to remove the threat of deportation for millions of unauthorized immigrants. By allowing young immigrants known as “Dreamers” to have Social Security numbers and permission to work in the United States, Obama effectively gave those immigrants everything they needed to get state-issued driver’s licenses, even in states that require license-holders to be in the country legally. When Obama tried to expand on the first executive order and issued a second including parents of U.S. citizens in a similar program, Texas and 25 other states sued to block both actions. Fifteen states backed Obama in the case, which has now reached the Supreme Court.

Texas has been at the forefront of Republican-led states that have chosen to sue the federal government at virtually every turn. The state has brought lawsuits against the administration at least 38 times since Obama took office, on matters including pollution regulations, the Affordable Care Act, gay marriage, Syrian refugees and the length of the red snapper fishing season. “I go into the office, I sue the federal government and I go home,” quipped Greg Abbott, then Texas’ attorney general, before he became governor.

The Obama administration has not been shy in going after states for what it sees as civil rights violations. The Justice Department challenged states on voter ID laws, redistricting plans and voter purges. It encouraged the U.S. Supreme Court to overturn state bans on same-sex marriage, which the high court did. Recently, it warned North Carolina that the state was jeopardizing its $2 billion in federal education funding by preventing transgender people from using the bathrooms of the sex with which they identify. “This is no longer just a North Carolina issue,” Gov. Pat McCrory, a Republican, fumed. “This impacts every state, every university and almost every employee in the United States of America.”

Republican attorneys general have coordinated multistate lawsuits against the administration, usually with the backing of their GOP governors. “It works well for states, because it delays unwanted federal action -- may even get rid of it -- and the governors take credit for fighting Washington, which very much plays to their base,” says Carol Weissert, a political science professor at Florida State University.

For a term-limited president, though, those delays mean lost opportunities. So Obama has had to look for different ways to roll out his policies. Lately, he’s spent a lot of time working with local governments.

Obama invited mayors to the White House in the first weeks of his administration. He has increasingly relied on city leaders as his presidency comes to an end. (David Kidd)

Just as Obama initially reached out to governors, he made a concerted effort early in his administration to court mayors and other local leaders. The president picked local officials for Cabinet posts on housing, labor and education. He created the Office of Urban Affairs in the White House, led by Adolfo Carrión, a former borough president of the Bronx. Obama held a White House meeting for governors, mayors and county executives early in his first term. “Our cities need more than just a partner,” he said. “They need a partner who knows that the old ways of looking at our cities just won’t do.”

But much of the energy around local initiatives dissipated as Obama and his team concentrated on showdowns with Congress and defiant state governments. Carrión left his job for another administration post, and eventually the office was folded into a different White House department.

In the last few years, though, cities have played an increasingly prominent role in White House initiatives. Obama tapped two mayors for Cabinet posts in his second term -- Julian Castro of San Antonio for Housing and Urban Development, and Anthony Foxx of Charlotte for Transportation. Jerry Abramson, a former Kentucky lieutenant governor and five-term mayor of Louisville, became the White House director of intergovernmental affairs in late 2014. Last year, Obama became the first president in two decades to address a meeting of the National League of Cities. “My gut feeling is not that there was a pivot from the state to the local communities. We’re still involved with both,” Abramson says. “But there are a lot more cities and counties than states.”

Lately, Obama has enlisted the help of cities with virtually every major priority of his administration. Often, it’s through the same types of competition and demonstration projects that the administration first used in the stimulus package. “This president clearly understands that one size does not fit all,” Abramson says.

Obama pushed cities, along with a few friendly states, to end homelessness among veterans; Salt Lake City, Phoenix and New Orleans were the first of 20 cities to claim success. The president launched a contest among a different set of 20 cities to sign uninsured residents up for health coverage under Obamacare. He used city officials in several efforts to combat and prepare for climate change. Obama has touted city efforts to increase the minimum wage and require companies to give their employees family leave. The administration has held competitions among

cities for federal money to support advanced manufacturing hubs and high-tech transportation systems. At least 240 cities have signed up for an administration effort to reduce pedestrian and cyclist deaths.

“When the White House has a major initiative on smart cities or around manufacturing innovations or around new antipoverty strategies, it’s got the bully pulpit. It’s got the ability to describe for a vast number of constituencies: Here’s the new way of doing things,” says Bruce Katz, an expert on metropolitan areas at the Brookings Institution who helped with Obama’s transition. “Ultimately, that then begins to seep out into the broader system.”

Katz says the demise of the urban affairs office may actually have helped the administration address cities’ needs, because it meant that every agency had to think about urban concerns. That helps the entire nation stay globally competitive, Katz believes, because cities and metropolitan regions around the world are getting more attention from national governments. “Across the administration, they’ve really taken steps to be a partner, not a decider, to be truly collaborative in a way that the federal government normally is not,” Katz says. “The federal government usually tells you what to do and what not to do as it shakes its finger at you. This is a very different kind of administration.”

In one sense, though, Obama’s approach to federalism is in line with that of his predecessors. “Presidents are fundamentally concerned about substantive policy goals and outcomes. Federalism is at best -- at best -- a secondary consideration,” says John Dinan, a Wake Forest University law professor and editor of Publius, a journal on federalism. “If that’s the fundamental concern, you’ll be partners with the states when they’re helping you to achieve what you want to achieve, and an adversarial relationship is more likely to result when your goals are different than the goals of state officials.”

When Obama couldn’t get his agenda through Congress, he relied more heavily on federal agencies. When Republican states were hesitant to help, Obama turned to Democratic governors, local leaders, or whoever was willing to help him make changes. “The policy goals,” Dinan says, “will generally prevail.”