SAN FRANCISCO — Public urination has gotten so bad in San Francisco that the city has painted nine walls with a repellent paint that makes pee spray back on the offender.

It’s the latest effort to address a chronic problem in a city where the public works director calls himself Mr. Clean: Walls are coated with a clear, liquid repellent material that goes on much like paint. When the wall is hit with urine, the urine splashes back on a person’s shoes and pants.

Mohammed Nuru, director of San Francisco’s public works department, says offenders will need to make the mistake only once to get the idea.

“If you have to go,” he said, “go in the right place.”

Nuru got the idea from Germany, where walls in Hamburg’s St. Pauli quarter are painted with the material to encourage late-night beer drinkers to find a bathroom rather than an alleyway.

Public urination has long been a problem in San Francisco, where a light pole corroded by urine recently fell on a car. The city appears to be the only one in the nation using Ultra-Ever Dry from a Florida-based company, and it’s already receiving a stream of queries about the product’s success.

“We are getting calls from all over the place: Washington, DC, Hawaii and Oakland,” said Nuru, who tweets under the handle @MrCleanSF.

Potential offenders get fair warning about the consequences of urinating on the coated walls that sit on public and private property around the city.

Signs hanging above some walls read: “Hold it! This wall is not a public restroom. Please respect San Francisco and seek relief in an appropriate place.”

Other efforts also are under way to stop or curb public urination.

Solar-powered toilets roll through city streets several afternoons a week, attendants are manning public toilets to encourage people to use them, and city crews will check thousands of light posts to make sure they won’t topple.

Public urination is a health concern, and keeping the city clean is a 24-7 battle, said Kevin Sporer, superintendent of the building repair bureau.

The new paint is paying off.

“There’s a lot less activity, and the result is noticeable,” Sporer said.

Public urination is illegal, but a fine of up to $500 passed in San Francisco in 2002 has seen little success.

On a recent weekday, resident Jon Kolb was in a public transit plaza in the Mission District, where crews recently painted a low wall with the repellent paint.

Kolb said he believes the idea is a good one. He has seen people who sleep in the plaza become visibly upset when others do their business on the walls.

“People will actually get violent about it,” Kolb said.

But will the paint really be a deterrent?

“It would be to me,” he said.

The paint and the labor to apply the material have cost the city only a few hundred dollars, as opposed to the $80 an hour to steam clean walls and sidewalks.

Since January, there have been 375 requests to steam clean urine from sidewalks and other areas. But that’s a 17 percent drop in the past year.

Another addition is attendants in a few of the 25 green Pit Stop public bathrooms around San Francisco. They clean and restock supplies and make sure people don’t use drugs or sleep inside the restrooms.

“We want people to have clean and safe bathrooms, so having an attendant there has made all the difference in the world,” Nuru said. “We want everyone to become educated. Don’t unzip. Hold it, and use the bathroom that is available.”

Meanwhile, the public utilities commission is checking the city’s 25,000 light posts for corrosion and other problems and replacing the ones that need it. This comes after the recent tumble of a three-story-tall light post that was old, corroded with a likely mix of human and dog urine, and weighted down by a large banner.