State Sen. Frank W. Wagner (R-Virginia Beach). (Steve Helber/Associated Press)

Virginia could be on the cusp of expanding Medicaid to 400,000 low-income residents, after a veteran Republican state senator said Friday he is willing to split with his party and help Democrats realize a goal they have been chasing for years.

State Sen. Frank W. Wagner (Virginia Beach) said he supports allowing more poor people to enroll in the federal-state health-care program on two conditions.

He wants the plan structured so Medicaid recipients do not suddenly lose coverage if their earnings rise. And he wants a tax credit or some other help for middle- ­income people who already have insurance but are struggling to pay soaring premiums and co-pays.

While those details remain to be worked out, Wagner’s position could break a standoff over Medicaid and the state budget in Virginia’s General Assembly, averting a government shutdown and handing an enormous win to Gov. Ralph Northam (D) just three months into his term. The legislature convenes Wednesday for a special session on the budget.

“We’re putting together a package, I hope, that helps as many Virginians as we can,” Wagner said in an interview with The Washington Post on Friday.

Democrats need two Senate Republicans to pass Medicaid expansion in that chamber as part of a state budget, the most conventional route for passage. The House already passed a version of Medicaid expansion earlier this year.

A second Republican, Sen. Emmett W. Hanger Jr. (Augusta), has supported certain forms of expansion for years but has objected to some aspects of the House plan. Hanger has been working with the Northam administration to overcome his objections in recent weeks, expressing optimism that they could strike a deal.

There is no guarantee that Medicaid expansion — a goal that eluded Northam’s Democratic predecessor, Terry McAuliffe — will happen.

The two Republican senators at the center of negotiations — Hanger and Wagner — have different goals. Hanger, for instance, seeks the elimination of a hospital “bed tax” that would be used to pay for the state’s share of the expansion, preferring to pay for it out of existing tax revenue. Wagner supports the tax but wants about half the $307 million it would raise to cover the cost of the health-care tax break he seeks for middle-income residents, which he said would amount to about $250 a year for families making $30,000 to $50,000 a year. His plan would use the rest of the bed-tax revenue to bankroll other state priorities, such as higher education and raises for teachers and state employees.

Wagner said he would support Medicaid expansion one day after members of the Senate’s Republican leadership declared they still had the votes to block passage.

“We are 21 strong,” Senate Majority Whip William M. Stanley Jr. (R-Franklin) said Thursday on a conference call organized by the conservative group Americans for Prosperity. Republicans control 21 seats in the Senate, compared with 19 held by Democrats.

Wagner’s statement Friday did nothing to change their tone.

“While Sen. Wagner’s plan may be well-intentioned, it is neither well-conceived nor well- ­designed,” Senate Majority Leader Thomas K. Norment Jr. (R-James City) and other GOP Senate leaders said in a joint statement Friday. “Giving some Virginians what would amount to a $20-per-month tax credit provides negligible assistance when people are dealing with multi-thousand-dollar deductibles and outrageous monthly premiums.”

But Northam applauded Wagner.

“Governor Northam is encouraged by Senator Wagner’s openness to a compromise that expands health coverage to thousands of Virginians who need it,” Northam spokesman Brian Coy said via email. “As the Senator notes, expanding Medicaid will allow Virginia to invest in other key priorities like health care, education and pay raises for teachers and law enforcement officers.”

A business-friendly pragmatist who has served 17 years in the Senate and nine years in the House before that, Wagner ran unsuccessfully for governor last year on a promise to raise taxes for transportation. He finished a distant third in the GOP gubernatorial primary.

Under the Affordable Care Act championed by President Barack Obama, Washington encouraged states to allow more people to enroll in Medicaid by offering to pick up most of the tab. Thirty-three states, including Maryland, and the District accepted the offer.

Virginia, with its legislature under GOP control, staunchly resisted “Obamacare expansion” under McAuliffe, who had made expansion his marquee campaign promise.

Northam, a pediatrician and former Army doctor who treated wounded soldiers in Operation Desert Storm, contends the state has not just a moral duty to care for the poor but an economic incentive to do so. Expansion would create a healthier workforce, encourage the poor to seek primary care rather than expensive emergency-room treatment and create 30,000 health-care jobs, he has said.

Critics have doubted the federal government would keep its promise to cover 90 percent of the $2 billion-a-year cost, at some point saddling the state with the bill. Some also have voiced philosophical objections to opening an entitlement program to childless, able-bodied adults, no matter how poor.

Opposition in the House softened after Democrats — who ran on a promise to expand Medicaid — picked up 15 seats in November elections, nearly taking control of the chamber in an anti-Trump wave. During the 60-day legislative session that began in January, 19 House Republicans voted to expand Medicaid, apparently concluding they have more to fear from energized Democrats and independents than from potential primary challengers on the right.

Several factors provided a measure of political cover for House expanders. Among them is the failure of Republicans on the national level to repeal the ACA despite their control of Congress and the White House. If “Obamacare” remains the law of the land, some expanders say, there is no reason not to sign on.

Some Republicans say the departure of two Democrats conservatives love to hate — Obama and McAuliffe — drained much of the emotion from the debate. The House’s messaging also may have helped. House Speaker M. Kirkland Cox (R-Colonial Heights) billed expansion as conservative “Medicaid reform” since the House plan would impose work requirements on recipients — something the Trump administration has supported elsewhere.

But the Senate, which did not face voters last year, remained firmly opposed during the session. Republican foes there said the House’s work requirement amounts to a meaningless “work suggestion” since it would operate on the honor system.

Hanger was the only Senate Republican to favor expansion during the session, and even he wanted substantial changes to the House plan. The standoff forced the legislature to adjourn March 10 without a budget. Legislators need to pass a budget by July 1 to avoid a government shutdown.

In the lead-up to Wednesday’s special session, both sides in the Medicaid fight have been trying to pressure legislators with public meetings, protests and ad campaigns.

Wagner told a Republican group a couple of weeks ago he believes Medicaid expansion will happen, so he wanted to get engaged to make the plan as “conservative as possible.”

Support from Wagner and Hanger is especially significant because they are two of the Senate’s six budget conferees. Together with the two Democratic conferees, they have the power to muscle a pro-expansion budget out of a conference committee and onto the Senate floor.

A third Senate Republican appeared to waver on Medicaid recently. Sen. Jill Holtzman Vogel (R-Fauquier) did not rule out voting for it, according to the Winchester Star.

Although it would take two Republicans to pass expansion on a budget vote, only one is needed to pass it as a budget amendment. That’s because the Senate’s presiding officer, Lt. Gov. Justin Fairfax (D), is allowed to break ties on budget amendments but not on the budget itself.