WASHINGTON (Reuters) - Two U.S. senators on Tuesday reached a bipartisan agreement to shore up Obamacare for two years by reviving federal subsidies for health insurers that President Donald Trump planned to scrap, and the president indicated his support for the plan.

The deal worked out by Republican Senator Lamar Alexander and Democratic Senator Patty Murray would meet some Democratic objectives, including reviving the subsidies for Obamacare and restoring $106 million in funding for a federal program that helps people enroll in insurance plans.

In exchange, Republicans would get more flexibility for states to offer a wider variety of health insurance plans while maintaining the requirement that sick and healthy people be charged the same rates for coverage.

The Trump administration said last week it would stop paying billions of dollars to insurers to help lower-income Americans pay medical expenses, part of the Republican president’s effort to dismantle Obamacare, former Democratic President Barack Obama’s signature healthcare law.

The subsidies to private insurers cost the government an estimated $7 billion this year and were forecast at $10 billion for 2018. Trump’s move to scuttle them had raised concerns about chaos in insurance markets.

Trump hoped to make good on his campaign promise to dismantle the law when he took office in January, with Republicans, who pledged for seven years to scrap it, controlling Congress. But he has been frustrated with their failure to pass legislation to repeal and replace it.

Obamacare, formally known as the Affordable Care Act, extended health insurance coverage to 20 million Americans. Republicans say it is ineffective and a massive government intrusion in a key sector of the economy.

The Alexander-Murray plan could keep Obamacare in place at least until the 2020 presidential campaign starts heating up.

“This takes care of the next two years. After that, we can have a full-fledged debate on where we go long-term on healthcare,” Alexander said of the deal.

It is unclear whether the agreement can make it through Congress.

Chuck Schumer, the top Senate Democrat, said it had “broad support” among senators in his party, but it was harder to gauge possible support among Republicans.

Moderate Republican Senator Susan Collins, who helped sink earlier Obamacare repeal legislation, voiced backing for the new plan, but conservative Republicans may be less welcoming.

Senator Bernie Sanders, an independent who ran for the Democratic presidential nomination in 2016, threw his weight behind the effort. In an interview with Reuters, Sanders said Alexander was a “well-respected figure” known for bipartisanship and that the Tennessee senator’s reputation would help propel the legislation through the Senate.

Slideshow ( 7 images )

The willingness of Sanders, a liberal champion, to offer his support of a deal with Republicans that could allow states to change some Obamacare requirements provided a boost to the Alexander-Murray effort. “We are going to overturn what Trump is trying to do,” Sanders said.

Schumer urged Senate Majority Leader Mitch McConnell to bring the plan to a vote on the Senate floor and urged the House of Representatives to take it up then as quickly as possible so Trump can sign it.

Slideshow ( 7 images )

TRUMP STILL SEEKS LONG-TERM SOLUTION

Trump, during comments at the White House, suggested he could get behind the Alexander-Murray plan as a short-term solution.

In remarks later at the Heritage Foundation, a conservative think tank, Trump commended the work by Alexander and Murray, but said: “I continue to believe Congress must find a solution to the Obamacare mess instead of providing bailouts to insurance companies.”

Trump said earlier he wanted lawmakers, once they completed a major tax reform effort, to again take up broader legislation that failed in the Senate last month that would divvy up federal healthcare money as block grants to states.

Murray is the top Democrat on the Senate Health, Education, Labor and Pensions Committee, and Alexander is its chairman.

She said the two were able to find common ground on the steps aimed at stabilizing the insurance markets created under Obamacare and to “help protect families from premium spikes as a result of the sabotage we have seen from this administration.”

According to a document seen by Reuters, the plan would make it easier for states to get waivers approved that would allow them to offer cheaper healthcare plans, including catastrophic health plans, which cover a limited set of benefits and are currently only available to those under 30.

Shares of U.S. hospital operators, including Tenet Healthcare Corp and HCA Healthcare Inc, moved higher after news of the deal. Tenet shares closed 5.3 percent higher, while HCA rose 2.2 percent. Shares of some U.S. health insurers also extended their gains on the day, with Anthem Inc finishing up 1.9 percent and Centene Corp gaining 3.2 percent.

Analyst Brian Tanquilut of global investment banking firm Jefferies, who focuses on hospital companies, said that if the deal is passed in Congress, it should stabilize the Obamacare insurance exchanges and improve their viability.

“Hospitals will avoid a potential spike in bad debt and charity care next year,” Tanquilut said. “This is obviously a good step. It’s bipartisan and guaranteed for two years.”