The ocean has been eyed as a panacea for California’s perpetual trials with drought. The idea is that with enough desalination plants, the vast sea will provide an endless supply of drinking water.

But as a handful of these much-hyped projects take shape along the coast, many communities have found that desalination makes a lot more sense inland. Dozens of landlocked water districts are turning to briny groundwater basins or brackish rivers and bays, where the process of removing salt from water is generally a lot easier and cheaper.

This week, the city of Antioch celebrated its place among eight communities selected to receive a share of $44 million in state money for desalting projects. Six of these — including Antioch’s — are not on the ocean.

Antioch officials intend to invest their $10 million slice of the funds into a $62 million plant that will desalinate water from the San Joaquin River. Though the city already taps the channel, the supply is often too salty for consumption because of inflows from San Francisco Bay, especially in the summer when Sierra snowmelt into the river is sparse.

Being able to draw water year-round would guarantee a near-constant supply for the city’s 111,000 residents. The city hopes to begin construction on the plant in early 2019 and complete it within 18 months.

“We’re going to partially drought-proof our community, which is rare in California,” said City Manager Ron Bernal.

About 2 percent of California’s drinking water comes from desalination, according to the state Department of Water Resources, which awarded the grants. The top supplier is the $1 billion Carlsbad Desalination Plant in San Diego County, which opened in 2015 as the nation’s biggest desalting facility. It provides up to 400,000 people with treated ocean water in an area long dependent on water imports.

Less than a half dozen plants serve up seawater for residential purposes, however. About two dozen sites, meanwhile, are treating brackish inland supplies, state records show. And more are in the works.

Beyond Antioch, the recipients of the state money for desalination are much farther south. Most plan to deploy the same reverse osmosis technology that is used in coastal projects, in which water is pushed through semipermeable membranes, to treat groundwater.

Eastern Kern County’s Indian Wells Valley Water District, for example, is looking to tap underground basins in the high desert for desalination. The city of Camarillo in Ventura County is proposing to desalt water from a local aquifer, where supplies have become increasingly saline.

The exceptions are in Orange County and the city of Santa Barbara. The South Coast Water District in Laguna Beach received money for a new beachfront desalination plant, while Santa Barbara was funded for upgrades to an existing seawater facility.

“I think (brackish projects) are still going to be more populous than the ocean water,” said Richard Mills, water recycling and desalination chief for the Department of Water Resources. “Ocean desalination projects tend to be higher cost, with more environmental hurdles.”

According to the Pacific Institute think tank in Oakland, an acre foot of seawater costs roughly $2,100 to treat, compared with $1,100 for the same amount of brackish water, which is a fraction as salty. Much of the expense of desalination comes from its high energy requirements. An acre foot of water is enough to supply one to two households for a year.

Getting permits for oceanfront plants is more difficult as well, in part because they threaten marine life, with intake valves sometimes sucking in fish and the salt-removal process leaving behind a toxic brine.

That’s not to say inland projects are problem-free. Desalination, which has made only modest technological strides in recent years, is still generally more costly than traditional water sources. Tapping groundwater and runoff captured in reservoirs often runs just a few hundred dollars per acre foot — though if new dams and new wells need to be built, the costs rise considerably.

The state money for desalination projects comes from Proposition 1, the $7.5 billion water measure approved by California voters in 2014, during the historic five-year drought. The funds are aimed at boosting water supplies and protecting watersheds.

In addition to the latest round of money for desalination projects, another $50 million is earmarked for salt removal.

Heather Cooley, who directs the water program at the Pacific Institute, said the high price of desalination, especially when treating ocean water, means the technology pays off only for communities with limited water sources.

“They usually pursue other options first,” she said.

A decade ago, at least 20 water agencies began planning desalination plants along the coast, Cooley said, but few ended up finding the projects worth pursuing.

In the Bay Area, the Alameda County Water District has been desalinating water from the Niles Cone Groundwater Basin, beneath Alameda Creek, since 2003. The plant in Newark, officials said, has helped the district weather dips in surface supplies during dry times, and last year provided 18 percent of the water going to 351,000 residents.

“It’s brackish water, so it’s a lot more economical than trying to do ocean desal,” said Laura Hidas, special assistant to the district’s general manager.

The plant proposed for Antioch is expected to make river water a third of the city’s supply during summers. In the past, the city hasn’t been able to tap the river in the dry months because there’s little snowmelt to flush out the saltwater intrusion from the bay. Instead, Antioch has bought water from the nearby Contra Costa Water District.

The new plant will be built alongside the city’s existing water treatment facilities, officials said. A 4-mile pipeline will carry the residual brine to a wastewater treatment plant.