SAN JOSE — A plan to build “tiny homes” for San Jose’s homeless residents passed its first major test Tuesday, and now the city must answer the most difficult question — where to put these micro sleeping cabins.

After a heated debate, the City Council voted 9-2 to approve a yearlong pilot program to build one tiny home village comprised of 40 units. Elected leaders by next month will come up with three potential sites for the tiny homes and eventually want to place a tiny home village in each of the city’s 10 City Council districts.

Councilmen Johnny Khamis and Donald Rocha opposed, saying the plan to create tiny homes is too costly, takes too long to build and only helps a small number of people. They said $2.3 million of funding dedicated to tiny homes is better spent on a master-lease program that involves the city leasing apartments and using them to house homeless residents.

An angry group of homeowners Tuesday had a resounding message on tiny homes: “Not in my backyard.” They faced off with housing advocates who pleaded with lawmakers to show compassion for the 4,000 people who are homeless in San Jose, one of the country’s most costly rental markets.

“Supporting housing is the solution to our homelessness crisis,” said Robert Stromberg, who works for the homeless nonprofit Destination: Home. San Jose can no longer be choosy about where to place homeless housing, he said. “The time to say no has passed. It is time for yes.”

But Sue Halloway, a retired government worker who bought her home in south San Jose 40 years ago, worried that putting a tiny homes village near her would pose a threat to children.

“This will increase neighborhood crime, blight, poor sanitation and threatens safety and health,” Halloway said Tuesday. “As we know Hepatitis A is rampant. Prop values dramatically drop. It will be a magnet for more homeless.

The plan, first proposed a year ago, involves building small 80-to-140 square-feet sleeping cabins to house up to 25 homeless people until 2022. Officials last week unveiled two designs for the homes, which include a small bed, windows and a locking door.

But the costs of the unconventional homes are a sticking point: $73,125 per tiny home to build 40 units. Rocha and Khamis questioned whether San Jose could use the money to find a quicker, cheaper way to house the poor. The master-lease idea, they said, offers a “significant cost advantage” over tiny homes because there are no development costs.

But San Jose officials said a master-lease program adds no new housing units to the market and it’s difficult to find apartments in a city with a slim 5 percent vacancy rate.

Mayor Sam Liccardo, who supported building tiny homes villages on up to three sites, said the city has “turned over every rock” and homeless solutions aren’t as quick and easy as they might appear. City staff said the tiny homes costs might go down by using volunteers and less expensive supplies.

Other solutions pondered by city leaders Tuesday included a safe parking program — pushed by Councilman Sergio Jimenez — and sanctioned encampments.

According to city officials, Santa Barbara operates a safe-parking program, which gives people who live in their cars or RVs a safe place to park at night, costing about $270,000 a year to operate. Santa Barbara has 150 spots available at 20 public and private parking lots.

The city of Seattle has sanctioned encampments, but it was not recommended by San Jose officials. It would cost $1.3 million a year, according to city documents. “While sanctioned encampments do provide another immediate solution, the habitability of these environments can degrade quickly,” said Ray Bramson, the housing department’s interim deputy director.

In Oakland, city officials moved unhoused people into Tuff Sheds — costing about $3,400 per shed. While it provides shelter, Bramson said, the sheds provide no insulation or electricity.

San Diego created large industrial tents on city-owned land, housing 700 homeless residents and costing about $6.3 million.

Though the council Tuesday voted on criteria to rank locations for potential tiny homes villages, it did not decide where they should go. An unprecedented backlash from neighbors last summer forced city leaders to trim a list of 99 potential sites to two before scraping the plan and starting over.

As some rallied against putting tiny homes near them, Councilman Raul Peralez on Tuesday volunteered to have the first tiny home community in his downtown San Jose district. So did longtime land use consultant Erik Schoennauer.

“I’m not interested in stalling much longer and neither are our community members,” Peralez said to applause and cheers. “We’re willing to step up.”

San Jose officials will rank potential sites based on who owns the land, its size and its proximity to schools and other homes. The tiny homes must be at least 1,320 feet away from schools and 530 feet away from residential homes — rules that are more stringent than medical pot shops.

A list of final sites is expected by next month. After the top three sites are chosen, city officials plan to launch community outreach and an environmental review process.