(Adds quotes from lawmakers, background on subsidies, stock prices)
WASHINGTON, Oct 17 (Reuters) - Two U.S. senators on Tuesday announced a bipartisan breakthrough to shore up Obamacare for two years by reviving federal subsidies for health insurers that President Donald Trump planned to scrap, and the president voiced support for the plan.
The agreement worked out by Republican Senator Lamar Alexander and Democratic Senator Patty Murray would meet some Democratic objectives, including a revival of 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 low-income Americans pay medical expenses, part of the Republican president's effort to dismantle Obamacare, former Democratic President Barack Obama's signature healthcare law.
"We are ironing out a few of the last details right now but I am very optimistic that we will be able to make an announcement with all the details very soon," Murray told reporters.
"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.
"This is a small step. I'd like to undersell it, not oversell it," added Alexander, who said he hoped to have "a significant number" of senators from both parties as co-sponsors of the plan.
It is unclear whether the agreement can make it through the Senate and House of Representatives, both controlled by the Republicans. Chuck Schumer, the top Senate Democrat, called on Senate Majority Leader Mitch McConnell to bring the plan to a vote on the Senate floor and urged the House to take it up after that as quickly as possible so Trump can sign it.
Trump, who campaigned for president last year on a pledge to repeal Obamacare, said on Tuesday the 2010 law, formally known as the Affordable Care Act, was a "disaster" and "virtually dead." He has been frustrated by the failure of Congress to dismantle the law.
But speaking to reporters at the White House, Trump suggested he could get behind the plan for a short-term fix that Alexander and Murray had settled on.
He said it would help get Obamacare through a "very dangerous little period." But he added he was still committed to a broader overhaul of the program.
"The solution will be for about a year or two years," Trump said at a news conference with Greek Prime Minister Alexis Tsipras.
But Trump repeated is criticism that the subsidies amounted to a giveaway by the federal government that had enriched insurance companies.
If the subsidies vanish, low-income Americans who obtain insurance through Obamacare online marketplaces where insurers can sell policies would face higher insurance premiums and out-of-pocket medical costs. It would particularly hurt lower-middle-class families whose incomes are too high to qualify for certain government assistance.
'OBVIOUSLY A GOOD STEP'
Trump said that once Congress completes work on his proposed tax overhaul, he hoped lawmakers would again take up 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."
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. Democratic attorneys general from 18 states as well as Washington, D.C., sued in federal court in California to try to block his move.
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 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." (Reporting by Yasmeen Abutaleb and Richard Cowan; Additional reporting by Lewis Krauskopf in New York; Writing by Yasmeen Abutaleb, Caren Bohan and Will Dunham; Editing by Jonathan Oatis and Peter Cooney)