The Thursday ruling in Sacramento County Superior Court means the $68 billion rail system can use the Pacheco Pass to connect the San Joaquin Valley with the San Francisco Bay Area.

"We continue to move forward to start construction this summer and create thousands of jobs in California," Jeff Morales, chief executive of the California High-Speed Rail Authority, said in a statement.

The peninsula cities and environmentalists had argued that the route through the Pacheco Pass, which is east of Gilroy, would harm the environment. They sued under the California Environmental Quality Act, but the court sided with the rail authority.

A route through the Pacheco Pass would bring the rail line directly into the peninsula and San Francisco from the south, partly using existing rail rights of way. The cities proposed an alternate route through the Altamont Pass, which is farther north and ends on the eastern side of San Francisco Bay.

The challenge with the Altamont route is how to get the high-speed rail line into San Francisco. Miles of track would have to be added to wrap it around the eastern and southern ends of the bay, an area that has extensive wetlands.

State lawmakers approved the first phase of the planned 800-mile line last summer, allowing the state to begin selling $2.6 billion in voter-approved bonds for construction of the first 130-mile stretch in the Central Valley. That approval allowed the state to tap $3.2 billion from the federal government, but where the rest of the money will come from to complete the system remains undetermined.

The state's business plan calls for some backing from private investors and for a private operator to run the system without a state subsidy. The first full segment of the system will run from Madera to Bakersfield, but the project eventually is supposed to link Northern and Southern California with trains traveling up to 220 mph.

Other legal challenges remain as the rail authority proceeds with planning and engineering work, particularly from groups representing Central Valley farmers seeking to block the project.