Tens of thousands of illegal in-law apartments now tucked into basements and garages throughout San Francisco could officially become part of the city's housing market under a plan to legalize those underground rental units.

But similar attempts to bring the so-called "granny flats" out of the shadows and into the legal light have failed over the past 20 years, victims of a variety of worries and concerns. Those concerns are expected to be raised Thursday when the City Planning Commission takes up Supervisor David Chiu's proposed legislation.

For Chiu, the timing is right for a change in the way the city handles the now-illegal units.

"Everyone realizes that we're in a housing affordability crisis right now," the supervisor said. "The people who live in these units are our most vulnerable residents."

Money is an important consideration. A March 2013 study of in-law units in the Excelsior district suggested that the below-market cost of the illegal units is the only way many low-income residents can afford to live in San Francisco.

While the Trulia real estate website suggests that a legal two-bedroom unit in that neighborhood would typically rent for about $2,400 a month, the study found that rent for a two-bedroom in-law apartment ranged from $1,000 to $1,200.

Marie Morales is learning just how few alternatives there are for affordable housing in the city.

Facing eviction

For 11 years, the physical therapist has lived in an illegal unit in a single-family home in the Parkside neighborhood, paying about $1,300 a month for a 900-square-foot, two-bedroom apartment she shares with her cat and a roommate. But in November, a new owner purchased the home. He's planning to evict her and tear out the illegal downstairs unit.

"I've looked around for a new place I could afford, but there's nothing," she said. "I'm going to have to move back in with people until I can save some money."

It's not just tenants who would benefit from Chiu's legalization plan. Any now-legal units would become part of the existing home and "allow the city to charge property tax on these units," according to a planning department report.

Unlike some of the previous legalization plans, Chiu's is all carrot and no stick. While the plan includes a number of incentives for homeowners to work with the city to legalize their existing in-law units, it's specifically designed to avoid penalizing those who can't or won't obtain the permits needed to bring their units under the building code.

The measure, which applies only to units built before Jan. 1, 2013, would waive existing requirements for open space, rear yards and density limits, but retain building and fire code rules.

Upgrading an existing unit to meet those codes, which can include minimum ceiling heights, width of hallways, staircases and fire sprinklers, can often be either impossible or prohibitively expensive, said John Rahaim, the city planning director.

"There are all sorts of interesting things people have done (to in-law units) over the years," he said.

Flexible rules

But rather than requiring that units that can't meet the code requirements be torn out, as is now the case, Chiu's measure would allow property owners to "prescreen" their units by having the Department of Building Inspection determine whether the unit is eligible for legalization.

If the unit can't be made legal, the ordinance "does not require the city to maintain any information on the existence of the unit, nor does it require immediate demolition of such unit," according to a staff report to the Planning Commission.

Allowing property owners to duck the legalization process and keep renting out their illegal units is a concern, said Janan New, executive director of the San Francisco Apartment Association, which represents property owners.

"Conceptually, we're OK with people making nonconforming units conforming," she said. "But what happens if a unit can't be brought up to code? It's a moral dilemma; we don't want people evicted, but we don't want them living in substandard housing, either."

But requiring demolition of those illegal units goes against the thrust of Mayor Ed Lee's new housing initiative, which is aimed at both building more homes and apartments and retaining the housing units that now exist.

"Our goal is to keep units if we can," Rahaim said, and legalizing in-law units would allow the city to retain a significant source of low-cost housing.

Any in-law apartments that aren't brought up to code will fall under the existing rules, which call for the city "to enforce when a complaint is filed against such units," the planning report said.

For owners of the illegal in-laws, that's a pretty safe bet. While unofficial estimates suggest there may be 30,000 to 50,000 off-the-grid units in the city, between 2000 and 2011, the city forced only about 250 to be torn out.

The threat of demolition, however, forces many tenants to accept substandard and sometimes hazardous conditions, just to make sure they still have a place to live, said Ted Gullicksen, executive director of the San Francisco Tenants Union and a supporter of Chiu's measure.

"If they call in a building inspector, they could lose their home," he said. "Landlords hold that over the head of tenants."

Essential housing

That 2013 Excelsior district study, done for the Asian Law Caucus, showed just how important those illegal units are to San Francisco's housing picture.

The survey found nearly 70 percent of the people living in that neighborhood of single-family homes were tenants and half of them lived in homes with, typically, illegal secondary units. More than 80 percent of the families in those in-law units were either Asian or Latino, and 86 percent of the households were very low-income, earning no more than half San Francisco's median income of about $73,000.

"These are the people we have to protect in the city," Chiu said, "and that's why I believe the issue has turned the corner."