Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

The U.S. Justice Department Thursday urged a federal judge to block enforcement of Boise, Idaho, city ordinances making it a crime to sleep in public places when homeless shelter space is unavailable.

"If a person literally has nowhere else to go, then enforcement of the anti-camping ordinance against that person criminalizes her for being homeless," the government said.

The court filing came in a legal battle that began in 2009 with a lawsuit filed by seven homeless people convicted of violating Boise ordinances that prohibit camping and sleeping in outdoor public places.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Enforcing such laws on nights when there isn't enough space in homeless shelters, the Justice Department argued Thursday, violates the Constitution's prohibition on cruel and unusual punishment.

Boise's city council voted last year not to enforce its laws when homeless shelters are full. But that did not resolve the dispute.

Supporters of the city laws say when people sleep on the streets, they are unsafe and residents feel less safe.

Lawyers for the city argue in court papers that Boise enforces the ordinances "in the parks, foothills, and other public areas not just to keep them safe and sanitary but also to allow users to utilize the public spaces as they were intended to be used."

Similar disputes have played out nationwide. A 2014 survey by the National Law Center on Homelessness and Poverty found 64 cities with laws like the one in Boise.

The U.S. Department of Housing and Urban Development estimates that half a million people are likely to be homeless on any given night. A study by the U.S. Interagency Council on Homelessness found that 42% of homeless people sleep in public locations such as under bridges, in parks, or on the sidewalks.

But the nation's courts are divided on the constitutionality of anti-camping ordinances.

In 2007, a federal appeals court ruled that enforcement of a Los Angeles anti-camping ordinance may be unconstitutional on nights when adequate shelter space was not available. That decision was vacated after challengers of the law reached a settlement with the city, which agreed to build more shelter spaces.