As the Supreme Court moves Tuesday to the heart of the challenge to President Obama’s signature health-care law, there is a curious twist: The case largely rests on the constitutionality of a provision that originated deep in Republican circles.

The individual insurance mandate, which requires virtually all Americans to obtain health coverage or pay a fine, was the brainchild of conservative economists and embraced by some of the nation’s most prominent Republicans for nearly two decades. Yet today many of those champions — including presidential hopefuls Mitt Romney and Newt Gingrich — are among the mandate’s most vocal critics.

Meanwhile, even as Democratic stalwarts warmed to the idea in recent years, one of the last holdouts was the man whose political fate is now most closely intertwined with the mandate: President Obama.

“The ironies to this story are endless and everywhere,” said John McDonough, a professor at the Harvard University School of Public Health who, as a Senate Democratic staffer, played a key role in drafting the law.

The tale begins in the late 1980s, when conservative economists such as Mark Pauly, a professor at the University of Pennsylvania’s Wharton School of business, were searching for ways to counter liberal calls for government-sponsored universal health coverage.

“We wanted to find an alternative that was more consistent with market-oriented economic ideas and would involve less government intervention,” Pauly said.

His solution: a system of tax credits to ensure that all Americans could purchase at least bare-bones “catastrophic” coverage.

Pauly then proposed a mandate requiring everyone to obtain this minimum coverage, thus guarding against free-riders: people who refuse to buy insurance and then, in a crisis, receive care whose costs are absorbed by hospitals, the government and other consumers.

Heath policy analysts at the conservative Heritage Foundation, led by Stuart Butler, picked up the idea and began developing it for lawmakers in Congress.

By 1993, when President Bill Clinton was readying his major health-care overhaul bill, the Heritage approach — subsidizing and facilitating the purchase of private health plans, while using the individual mandate to maximize participation — had gelled as the natural Republican alternative.

Then-Sen. John H. Chafee (R-R.I.) formally proposed it in a bill that attracted 20 Republican co-sponsors; the bill foundered once Clinton’s effort unraveled. But the idea of the mandate gained currency in the ensuing years as Democrats chastened by the failure of the Clinton plan began considering new solutions more likely to attract bipartisan support.

The Massachusetts plan

That process came to a head in 2004 when Mitt Romney, then governor of Massachusetts, turned to then-Sen. Edward M. Kennedy (D-Mass.) for help adopting a health-care overhaul for the state that was largely based on providing residents with government subsidies to buy private insurance.

The plan, signed into law in 2006, regulated insurance companies to a degree beyond anything Pauly had envisioned: For instance, they were barred from excluding or charging higher premiums to people with preexisting health conditions.

But this only heightened the conviction of the health-care plan’s Republican backers that an individual mandate was needed. Without it, they argued, people could wait until they were sick to buy insurance, forcing insurers to pull out of the market or cover the extra cost by massively increasing rates.

McDonough said it is hard to overstate the significance of Kennedy agreeing to take on the free-market ideas advanced by Romney.

“The alliance between Romney and Kennedy was of fundamental importance in terms of creating a level of confidence going into [the] 2008 [presidential elections] that this could actually be the bipartisan path to achieve universal health care in the United States,” he said.

The no-mandate candidate

Indeed, during the 2008 Democratic primary race, candidates Hillary Rodham Clinton, John Edwards and Obama all proposed health-care overhaul plans that shared some features of the Massachusetts system.

But while Clinton and Edwards included an individual mandate, Obama did not (although he did propose requiring parents to get coverage for their children).

Over successive debates and primary battles, Obama hammered the issue as a key difference between himself and Clinton.

“What’s she not telling you about her health-care plan?” said an advertisement for Obama. “It forces everyone to buy insurance, even if you can’t afford it, and you pay a penalty if you don’t.”

“In retrospect, I think Obama had an accurate sense of public opinion about the mandate,” said Paul Starr, a health policy expert at Princeton University, who supports the law but argues that Democrats should have come up with other policies to accomplish the goals of the mandate.

Obama’s views had evolved by December 2008, when, a month after winning the presidential election, he discussed the mandate with former Senate majority leader Thomas A. Daschle (D-S.D.), his nominee for health and human services secretary.

“To my pleasant surprise, the president-elect told us, for the first time, that he might be willing to reconsider his thinking,” Daschle wrote in his book “Getting It Done: How Obama and Congress Finally Broke the Stalemate to Make Way for Health Care Reform.”

The GOP shift

For a while the mandate also retained the support of many prominent Republicans. But as negotiations with Democrats over the health-care bill fell apart in the spring of 2009 — and Republicans spent their August 2009 recess at town hall meetings where furious tea party activists accused them of fomenting a government takeover of health care — positions on the mandate started to shift.

That September, Sen. Charles E. Grassley (R-Iowa), a co-sponsor of the 1993 Chafee bill containing the mandate and a vocal supporter of the idea just three months earlier, declared that “individuals should maintain the freedom to choose whether to purchase health insurance coverage or not.”

During floor debates over the health-care legislation that fall and winter, the mandate took a back seat to more contentious issues relating to abortion, Medicare and the expansion of government regulation.

Still, it continued to build as a political issue after the law’s adoption in 2010, as 27 states began having success with legal challenges largely centered on the mandate’s constitutionality.

Today, opposition to the mandate has become a kind of litmus test of conservative purity. Romney and Gingrich have each struggled, with mixed success, to disavow their former statements in support of it.

Intellectual authors of the idea at the Heritage Foundation have filed legal briefs contesting the mandate and have published mea culpas. “We had made a mistake,” Butler wrote, explaining that “health research and advances in economic analysis have convinced people like me that an insurance mandate isn’t needed to achieve stable, near-universal coverage.”

There is at least one remaining conservative defender: the man who helped start it all, Mark Pauly. He is no fan of the other provisions in 2010 health-care law. Still, he said, when it comes to the mandate, “personally, I think it’s wise public policy.”