The Gallery Place Metro station in January. (Salwan Georges/The Washington Post)

THE DETAILS remain in doubt, but the outcome seems all but assured: The region’s decades-long effort to shore up Metro’s finances appears to have finally achieved a breakthrough success. At long last, Metro, virtually the only major transit system in the United States lacking a guaranteed, permanent source of funding for long-term projects and major equipment, is being thrown a lifeline.

It took this long — Metro’s rail service began more than 40 years ago — in part because of the system’s complex parentage: Maryland, Virginia and the District of Columbia are all responsible for it (with an assist from the federal government), and any financial fix requires coordination among them, a herculean task. The District, its fortunes tightly yoked to Metro’s, needed little convincing that a bailout was critically important. Capturing the attention of lawmakers in Annapolis and Richmond, many of whose constituents are untouched by Metro’s travails, proved a taller hurdle.

Now, with a historic funding deal all but done in Maryland and the elements of one teed up in Virginia, Metro is on the verge of securing a landmark agreement that would provide it with roughly $5 billion in additional capital funding over the coming decade, excluding what it would enable Metro to borrow. That’s about 50 percent more than the current allocation and matches the amount Metro General Manager Paul J. Wiedefeld, and outside experts, have said is needed to reverse the effects of years of underinvestment, whose costs are now evident in flagging reliability, falling ridership and regular mishaps.

In Maryland, Gov. Larry Hogan (R) deserves credit for having abandoned his original opposition to transit projects generally and a Metro bailout in particular. His evolution provided part of the impetus for lawmakers in Richmond, where the legislature is controlled by Republicans, to get serious about a substantial funding bill.

In the event, they produced one that would generate $154 million in additional annual funding, which is equal to Virginia’s portion of the new $500 million allotment under the existing regional cost-sharing formula. That package includes $30 million redirected from existing state transportation funds, which seems a bare minimum considering that Metro undergirds Virginia’s most economically vital region. In addition, it is burdensome for Northern Virginia, a Democratic stronghold; about half the new money would be diverted from existing transportation projects in the region. Republicans blocked most Democratic proposals for new revenue from taxes, including an increased levy on hotel rooms in the region that would mainly affect business travelers and other visitors from out of town.

Still, under Virginia law the bill can and likely will be tweaked by Gov. Ralph Northam, a Democrat who has supported efforts to provide Metro with a more secure financial future. The amended legislation would then be sent back to the General Assembly.

A vote on final passage would then take place this spring. Lawmakers should be mindful of the stakes, which involve not just Metro and Northern Virginia’s economic vitality but also the region’s chances of landing the second corporate headquarters of Amazon, which has made clear the importance it attaches to transit. The stakes could not be higher.