– On a narrow strip of land between the sidewalk and the street, Becky Niemi draped her tarp over two shopping carts. Then she spread out a purple quilt and settled in for the night.

Her snug spot offered protection from sporadic spring showers, and so long as she vacated by 7 a.m., a “safe sleep policy” for the homeless is supposed to keep her from getting harassed by police.

“Before, they would threaten to throw you in jail if you had this up,” said Niemi.

Portland Mayor Charlie Hales rolled out the new rules in February as a six-month experiment that explicitly authorizes — from 9 p.m. to 7 a.m. — sleeping bags on the sidewalks and tents or other temporary structures on rights of way and other city spaces.

Among cities grappling with homelessness, Hales’ policy represents a controversial move to establish rules for the homeless who end up outside of organized camps and shelters.

The mayor has linked this initiative to other efforts that include police sweeps of large, illegal camps where the rules are not followed, and a push to establish more authorized tent encampments for shelter.

“Most of our homeless population are simply looking for a safe night’s sleep, and have suffered needless trauma that comes with uncertainty about where that safe night’s sleep can be,” said a statement released by the city.

In Portland, some have already rejected the idea.

In April, a half-dozen business and neighborhood groups filed a lawsuit against the city. The plaintiffs said that Hales overstepped his authority when he crafted the rules without City Council approval.

“We’re not solving anything,” said Paul Conable, a Portland attorney who represents the plaintiffs.

Homeless advocates welcomed the acknowledgment that there should be a way for those without shelter to sleep without fear of being rousted by police. But it’s not easy for people to pack up in the morning and stay on the move.

“It doesn’t create the type of stability that allows them to rebuild their lives,” said Yurij Rudensky at Columbia Legal Services in Seattle.

As development has intensified, the homeless have increasingly moved from downtown to other parts of the city. Their camps proliferate along sidewalks, in parks and near residential areas.

That has tensions on the rise. A spate of fires has hit homeless camps since January, along with high-profile crimes. A homeless man was shot in March by another camper as he slept in a tent blocks from an elementary school.