A 34-year-old man is facing several charges, including attempted murder, after he allegedly shot at an officer and barricaded himself inside a Richmond Hill home for 12 hours on Friday, York Regional Police say.

The man appeared in a Newmarket courthouse on Saturday morning.

Police say the incident began around 10:30 a.m., when an officer made a traffic stop near the intersection of Bayview Avenue and Major Mackenzie Drive.

Const. Laura Nicolle said the driver of the stopped vehicle opened fire and the officer shot back. The suspect then fled into a nearby residence on Elmwood Avenue.

Police said the man was considered armed and dangerous.

Officers negotiated with the man for hours, and shortly after 10 p.m., he was placed under arrest.

The man, a Richmond Hill resident, has been charged with 11 offences, including:

Attempted murder

Dangerous weapons

Careless use of a firearm x2

Point firearm

Carrying a concealed weapon

Unauthorized possession of a firearm

Possession of a restricted firearm with ammunition

Firearm possession contrary to a prohibition order

Assault with Intent to resist

Dangerous driving

The province's police watchdog, the Special Investigations Unit, invoked its mandate, saying it was possible the man was hit by police gunfire. The incident is still under investigation.

The man will appear in court again on Jan. 2.