When Ana Maria Mendonça was hit by a stray bullet while standing at a bus stop, it's safe to say her first thought wasn't to sue Rio de Janeiro for its lack of security.

Not only are police bullets among those that cause the scores of stray bullet deaths and injuries in Rio each year, but few Cariocas, as people from Rio de Janeiro are known, really believe the city's notoriously corrupt and violent police force are there to serve and protect.

"The city of Rio de Janeiro is caught up in a whirlpool of violence," Judge Marco Antonio Ibrahim said in his summation. "People are being assassinated by stray bullets in their homes, at bus stops, in schools, on beaches, and at football stadiums. Saying the state is not responsible is, in practice, blaming the victim."

The city has appealed the decision, claiming it cannot be held responsible for the "omissions" of police officers.

The attorney general's office would not make anyone available for interview, but in a statement it said: "The state recognizes that public security is a constitutional obligation but nevertheless understands that this obligation is generic, not specific. The damage was not caused directly by an agent of the state."

More than 5,700 homicides

The judge's decision, however, is of clear concern for a state that recorded 5,717 homicides last year, almost three-quarters of them from gunshots.

Awarding damages for the police's lack of action – the bus stop where Mendonça was hit in 2007 is in a notoriously violent area and yet lacked a police presence – could open the flood gates to more suits.

"This sets a great precedent," says Margarida Pressburger, a lawyer at Brazil's Bar Association who is counseling other victims of stray bullets to take on the state. "This is the first such case and we are helping others with legal advice."

The stray bullet phenomenon is particular to Rio, a city dotted with hills where armed gangs often fight bloody battles for control of the drug trade.

Those firefights are sometimes carried out above residential areas, endangering the people below.

Last year, 16 people were killed by stray bullets and 220 were injured, according to police figures. Some were struck down without warning from shots fired thousands of yards away, while others were hit as they cowered from shootouts happening right in front of them. Some were even hit in their own homes by bullets that pierced windows and doors.

That randomness has given stray bullets a feared and almost mythical status in Rio. They creep up in conversation, in song, and have even been featured in Brazil's famously dramatic soap operas. In one memorable case, a stray bullet hit a pet tortoise, forcing its owners to replace its damaged back feet with prosthetic wheels.

Ms. Pressburger notes that the case ins not closed, and could well go all the way to the Supreme Court. But at the least, she says, authorities have been given a wakeup call.

"Finally, there is justice," she says. "We pay taxes so the state can guarantee our security. In the past, everyone has avoided taking responsibility. Now, someone has to pay."