A potentially explosive device was detonated west of Toronto on Tuesday after police removed the object from a Brampton church earlier in the day.

The device, which appeared to be a pipe bomb, was discovered inside the St. Jerome's Roman Catholic Church, at 8530 Chinguacousy Road, when emergency crews responded to a fire at about 3:45 a.m.

A janitor called authorities when he arrived at work at about 4:30 a.m. and found smoke billowing from the church.

"I saw inside the church there was a lot of smoke," Alipin Rocha told CTV Toronto. "I went in to check and there was fire."

It appears someone had smashed a window and placed the object inside the church before the building's sprinkler system doused the blaze.

Members of the Peel Regional Police explosive disposal removed the object from the church at about noon drove it to the Lafarge Pit in nearby Caledon, Ont., for the controlled detonation.

The Ontario Fire Marshal's office is investigating the incident at the church and is trying to determine whether it is related to a fire at a row of new homes a short distance away.

Fire officials said that the row of townhouses on Financial Drive, near Mississauga Road north of Steeles Avenue, caught fire some time before 4 a.m.

The townhouses, only a few kilometres from the church, were built recently and had yet to be occupied.

No one was injured in either fire.

With files from CTV Toronto's John Musselman