JOHANNESBURG, South Africa — Four men were sentenced today to 18 years in jail for the murder of 19-year-old lesbian Zoliswa Nkonyana, after more than 50 delays in a case that dragged on for six years.

The court in Khayelitsha, a Cape Town township, found that the men killed Nkonyana because she was living openly as a lesbian.

Nkonyana was stoned and stabbed nine times outside a Khayelitsha "shebeen," or informal tavern, in February 2006. She died only 10 feet from her home.

South Africa's progressive constitution protects its citizens from discrimination based on sexual orientation, but black lesbians, gays and transgender people living in the townships continue to face violence and discrimination.

More from GlobalPost: South Africa: Zulu king's 'gay slur' causes uproar

Lubabalo Ntlabathi, Sicelo Mase, Luyanda Londzi and Mbulelo Damba were each given 18 years, with their jail terms each suspended for five years. Five other people were acquitted in the case.

The South African Press Association reported that the crowd outside the Khayelitsha court "cheered, sang, raised their fists and danced when news came that the men had been sentenced."

Magistrate Raadiyah Wathen said it was clear the killing "was driven by hatred and intolerance," and the tough sentence was meant to send a message that violence based on sexual orientation will not be tolerated, SAPA said.

More from GlobalPost: South Africa fails to protect black lesbians: rights group

Wathen said that while the accused had a right to disagree with Nkonyana’s lifestyle, it was wrong to resort to violence, News24 reported.

“Life is about choice. Zoliswa Nkonyana didn’t have the freedom to live out her choice. Violence will not go unpunished,” Wathen said.

South African group Triangle Project said in a statement that the 18-year jail sentence was precedent-setting for South Africa's justice system, by "acknowledging hatred and intolerance based on sexual orientation as an aggravating factor."

More from GlobalPost: Mounting violence haunts South Africa’s gays and mobilizes activists