A Brazilian state policeman who confessed to killing a judge probing a group of corrupt officers in metropolitan Rio de Janeiro has been sentenced to 21 years behind bars.

Sergio Costa Junior was sentenced Tuesday to 18 years in prison for the Aug. 12, 2011, assassination of Judge Patricia Lourival Acioli outside her home in suburban Rio and to three years for criminal conspiracy.

The defendant's sentence was reduced after he confessed to the crime and pledged to cooperate in the investigation of 10 other police who are suspected in the murder and scheduled to be tried in 2013.

Acioli, a 47-year-old mother of three, was shot 21 times as she sat in her vehicle waiting for the garage door to open.

Investigators determined that government-issue weapons were used in the attack.

The judge, who presided over a criminal court in the municipality of Sao Gonçalo, handled murder cases and was known for her tough stance toward members of "extermination groups" that kill petty criminals, beggars and homeless people in Greater Rio de Janeiro.

The death squads are led by rogue police officers, often acting in league with organized-crime elements.

Among the people Acioli convicted of vigilante murders were militiamen and criminals engaged in fuel and transportation rackets.