ISLAMABAD — A Pakistani judge dismissed an attempted murder charge Saturday that police lodged against a nine-month-old boy, ending a bizarre case that drew new criticism to the country’s troubled criminal justice system.

The family of toddler Mohammad Musa had kept the boy in hiding after authorities pressed charges accusing him of trying to kill police officers after a neighbourhood brawl in Pakistan’s eastern city of Lahore. Judge Rafaqat Ali Qamar dropped the case against the boy during a hearing in which police announced they would no longer pursue the charges, defence lawyer Irfan Tarar said.

“The father of toddler produced him before the judge today,” Tarar said. “The boy was in the arms of his father when police submitted a report, stating they have dropped the charge against the boy.”

Qamar also reprimanded police in court, demanding a written explanation about why officers did not properly investigate the case, Tarar said.

The case stems from an incident Jan. 31, when power company officials went into the boy’s neighbourhood to disconnect illegal power lines allowing people to get electricity to their homes without paying for it. Such pilferage is common in Pakistan, and attempts to disconnect customers can be met with violence.

A family member holds nine-month-old Mohammad Musa, trying to avoid media as they leave after the boy’s court appearance in Lahore, Pakistan on April 12, 2014. K.M. CHAUDARY/THE ASSOCIATED PRESS

Police said in this case, neighbours threw stones at energy company officials and their officers. The boy’s grandfather, Malik Muhammed Yaseen, earlier told The Associated Press that neighbourhood women attacked the police with batons only after officers mistreated residents.

That altercation sparked police to open an attempted murder investigation into 30 people in the neighbourhood, including the father of the toddler and his son, police officer Atif Zulfiqar said earlier this week.

Yaseen said police came to his house multiple times looking for the boy. He said the family told police that the boy was less than a year old, but officers demanded they take him to court. The boy received bail and wept as police took his fingerprints.

The case highlighted the country’s dysfunctional criminal justice system, where even children are not immune. Pakistan’s police, widely criticized as improperly trained and ill-equipped, is routinely accused of torturing suspects and extorting people for bribes. Flaws in the country’s legal system and poor police investigations often see criminals and terrorists released, while militants routinely target officers in their attacks.

The boy’s parents could not be reached for comment Saturday after the judge’s decision, but Tarar said the toddler’s whole family was very happy.

“After today’s court order, the nine-month-old boy is free to live anywhere,” he said. “This case is an eye opener, and we hope and expect that police will avoid any repeat of such mistakes.”