SACRAMENTO — Nearly five years after Peninsula cities first sued to block California’s high-speed train from running along the Caltrain corridor, a judge has dismissed the case in a long-awaited victory for bullet train backers.

Sacramento Superior Court Judge Michael Kenny’s ruling, released Thursday, means that the state finally proved it was legally correct in December 2007 when it decided to send its planned $69 billion high-speed rail network up the Pacheco Pass from the Central Valley, zipping bullet trains from San Jose to San Francisco. An alternative plan that environmentalists and some Peninsula cities preferred would have sent the trains up a longer East Bay route through the Altamont Pass.

Officials of the California High-Speed Rail Authority breathed a sigh of relief as they head toward a groundbreaking on the controversial project in the Central Valley as soon as July.

“This is an important ruling and testament to the fact that the authority is committed to delivering the high-speed rail project in accordance with the law and in partnership with the public,” rail authority CEO Jeff Morales said in a statement. “We continue to move forward to start construction this summer and begin creating thousands of jobs.”

Atherton, Menlo Park, Palo Alto and environmental groups in August 2008 sued to block the plan, leading to an epic legal saga that resulted in numerous public hearings and 163 court filings. They argued that the Peninsula route would negatively harm the environment and sued under the California Environmental Quality Act.

Judge Kenny in 2009 and again in 2011 ruled in favor of the Peninsula cities, forcing the rail authority to spend about a year each time revising its plans slightly while still keeping the same Peninsula route. The rail opponents last year again tried to force rail officials to redo their plans for a third time — but Kenny said in Thursday’s ruling that enough was enough.

“The judge has essentially said this time, ‘Yeah (the state) got it right,'” said Stuart Flashman, an attorney representing the Peninsula cities. “I’m not 100 percent surprised. Each time when you go back and do this again, it gets a little harder.”

Atherton Vice Mayor Jerry Carlson, however, has not resigned himself to the bullet train coming through his town. He notes that the state still needs tens of billions of dollars to extend the line to the Bay Area.

“It’s a long time from now, and they’re going to need a lot more money than what’s on the table,” said Carlson, whose town last week donated $10,000 to a separate Central Valley lawsuit against the bullet train.

Kenny said in his ruling that the rail authority “reasonably and in good faith” revised its plans to meet all the legal concerns addressed over the years by the Peninsula cities — and that it no longer was in violation of any California environmental laws. Previously, Kenny had ruled that the rail authority failed to fully study alternative routes along the Union Pacific right-of-way in San Jose, the effect of track vibrations on local communities and the impact of traffic on city streets.

Flashman said he would discuss with his clients a possible appeal to a higher court. Another case by the same plaintiffs is now winding its way through the state Court of Appeal, and it probably won’t be heard until this fall.

The case had been held up by businesses as an example for reforming California’s landmark environmental law, an effort under way in the Legislature this year. The Peninsula cities, which are opposed to the rail line coming through their idyllic towns because they believe it will be noisy and unattractive, had used the law as grounds to sue and delay the state’s biggest ever public works project, costing the state tens of thousands of dollars in court fees.

The judge’s ruling comes after two settlements the rail authority reached in recent weeks with opponents in the Central Valley who had sued to halt the rail line.

The one significant case remaining against the project will be heard in court in April. In that case, Madera farmers opposed to the bullet train, suing under the state’s environmental law, have asked a judge to block this summer’s groundbreaking.

Contact Mike Rosenberg at 408-920-5705. Follow him at twitter.com/RosenbergMerc.