ISLAMABAD, Pakistan — A Pakistani judge on Thursday formally dismissed terrorism charges against a man whose killing in a police encounter last year threw a spotlight on extrajudicial killings and police brutality in the country.

A judge of the antiterrorism court in Karachi dropped five cases against Naqeebullah Mehsud, an aspiring model with a large social media presence whose death prompted widespread protests. The judge also posthumously cleared three other men who were killed with Mr. Mehsud.

The court acted in the wake of a police inquiry that found that the supposed shootout in which the four men died in Karachi last January had been staged, and that their killings were extrajudicial.

The operation was led by a prominent police commander named Rao Anwar, who was known for his harsh tactics. Mr. Anwar initially claimed that the four men were part of a militant group that had been involved in attacks on security forces in Karachi, considered the country’s financial and commercial hub.