Ontario's Special Investigations Unit said a man entered the court house in Brampton, Ontario and fired shots, injuring a police officer in the security screening area before being shot dead by police. The wounded officer is in stable condition at a Toronto hospital.
Such shootings in Canada are rare.
Alex Anderson said he was in the hallway of the first floor of the building when he heard a shot being fired.
"I heard one shot and I didn't think too much of it," Anderson said. "Then a series of shots that just went two, three, four, five. In that process, people were running. Everyone was scattering to the nearest courtroom that they can just get into."
He said he later returned to the first-floor hallway and saw what appeared to be a covered body lying on the floor near the building's entrance.
Staff Sgt. Dan Richardson identified the officer as Constable Mike Klarenbeek, a veteran of almost 30 years who worked at the court for about five years.
The SIU said it has assigned fifteen investigators and three forensic investigators to probe the circumstances of the shooting.
Associated Press Writer Rob Gillies in Toronto contributed to this report.