U.S. President Barack Obama signs the Affordable Health Care for America Act during a ceremony with fellow Democrats in the East Room of the White House March 23, 2010 in Washington, DC. Win McNamee | Getty Images

House Speaker Nancy Pelosi lost her gavel and regained it in this decade. Obamacare played a major role each time. In 2010, a voter rebellion against the health-care law helped Republicans wallop Democrats and gain House control. Eight years later, Democrats made GOP efforts to scrap Obamacare the centerpiece of their campaigns and then won back the chamber. "I'll just tell you that the lesson from all of this is that health-care policy is treacherous politics," said Carlos Curbelo, a former Republican congressman. He won Florida's swing 26th District in 2014 after a campaign in which he promised to repeal Obamacare, then lost his seat to Democratic Rep. Debbie Mucarsel-Powell in 2018 following a vote to scrap the law. In the nearly 10 years since the Patient Protection and Affordable Care Act became law in March 2010, it has gone from political anchor to tailwind for Democrats. President Barack Obama's signature legislative achievement became one of the defining issues of the decade and shaped recent elections more than just about any other policy issue.

"Backlash to the ruling party's actions on health care were a significant part of both the 2010 and 2018 waves," said Kyle Kondik, managing editor of election forecasting site Sabato's Crystal Ball. He added that resistance to the law also probably helped the GOP in the 2014 midterms, especially after a messy rollout of the insurance exchange website in 2013. Obamacare sentiment reflects broader trends in American political opinion, Kondik said. Voters often buck the party in power, so the Affordable Care Act was less popular under Obama but gained traction once President Donald Trump took office. Both Democrats and independents started to feel better about Obamacare after Trump entered the White House, driving the increase in popularity, according to monthly Kaiser Family Foundation tracking polls. Democratic calls to maintain the law — particularly its provisions protecting Americans with preexisting medical conditions — appeared to resonate with voters when Republicans got a real chance to replace the health system. "Health care was on the ballot, and health care won," Pelosi told reporters in November 2018 after Democrats flipped House control.

Obamacare backlash hurt Democrats early

The landmark law better known as Obamacare offered new subsidies for buying plans, barred insurers from denying coverage based on preexisting conditions, allowed states to expand the joint federal and state Medicaid program for low-income Americans and let children stay on their parents' plans until age 26, among other provisions. Last year, 8.5% of the U.S. population was uninsured, down from 13.3% in 2013, before Obamacare fully took effect. Before the shift, the Affordable Care Act appeared to hurt Democrats politically at the outset as Republicans billed it as a government takeover of health care. While a plurality of voters approved of the law a month after its passage, sentiment changed before the 2010 midterm elections, according to Kaiser surveys. In October 2010, 44% had an unfavorable view of the law, while 42% saw it favorably. In the 2010 elections, Democrats lost 63 House seats. Republicans flipped the chamber and kept control until this year. The GOP also gained six Senate seats. The incumbent president's party almost always loses seats in midterm elections. Even so, Obamacare appeared to propel the Democratic drubbing. Nearly half – or 45% – of voters said their 2010 vote was a message of opposition to Obamacare, according to exit polling cited by NBC News in 2014. Only 28% responded that their vote was a message of support for the law. After Republicans took over the House in 2011, then the Senate in 2015, they tried to repeal the Affordable Care Act dozens of times. The party made opposition to the law a central part of its political messaging for years — though Obamacare remained safe as long as its namesake president sat in the Oval Office.

The GOP gained another 13 House and nine Senate seats in the 2014 midterms. Following the election, then-House Speaker John Boehner said resistance to the health-care law drove the results. "The American people have made it clear: They're not for Obamacare. Ask all those Democrats who lost their elections Tuesday night. A lot of them voted for Obamacare," he said in November 2014. Exit surveys cited by NBC News suggest the health-care law had a smaller effect in 2014 than it did in 2010. Only 28% of voters said they wanted to express opposition to Obamacare, while 12 percent said they aimed to show support for the law.

Repeal efforts damage the GOP

When Trump won the White House and the GOP held control of Congress in 2016, Republicans finally got their chance to dismantle Obamacare. While the House passed a repeal bill in 2017, the Senate never could. The GOP fell one vote short in a dramatic late-night vote on a bill to roll back major parts of the ACA. The Trump administration has managed to dismantle pieces of Obamacare, both through administrative and legislative action. The GOP tax law passed in 2017 to end the individual mandate, a divisive provision that required most Americans to have health insurance or pay a penalty. Public opinion around the law started to shift after Republicans gained control of the White House and Congress and started to propose their own alternatives to Obamacare. For nearly all of the stretch from February 2013 to February 2017, monthly Kaiser polls found a larger share of adults had a favorable view of the law than unfavorable. But in every month since May 2017, Kaiser has found more adults like the ACA than dislike it. In November, 52% of adults surveyed by Kaiser had a favorable view of Obamacare, versus 41% who had an unfavorable opinion. Curbelo said opposition to Trump, and his most prominent policy push in trying to unravel Obamacare, helped to drive a rough 2018 election for the GOP. "A large part of the debacle that was that election, certainly in the House, can be attributed to health care," he said. The former congressman said he does not regret his vote to pass the American Health Care Act, the House Republican ACA overhaul, even now knowing he lost his seat. Curbelo said the vote "was about keeping [his] word" to repeal and replace Obamacare, which he had promised to do since he first ran for Congress.

How Obamacare is shaping the 2020 race

Health care will likely play a huge role in the 2020 elections, as well. Democrats have targeted the Trump administration over its decision not to defend Obamacare in a lawsuit seeking to toss out the law. Earlier in December, a federal appeals court ruled that the law's individual mandate was unconstitutional, but left the law largely intact as it punted to a lower court the question of whether the rest of the law should be thrown out. That decision could take another year or so.