A bear that wandered into a community northeast of Toronto has been tranquilized and is being brought to a safe location.

The bear was found in a tree in Port Perry, Ont., about 83 kilometres northeast of Toronto. Officers with the Durham Region Police Service and Ministry of Natural Resources and Forestry managed to capture the animal after several hours.

“It probably went up the tree in the first place because it unintentionally got into a populated area and was quite scared by that,” Jolanta Kowalski, a spokesperson for the MNRF, told CTV Toronto.

After getting hit by the tranquilizer, video from the scene shows the bear falling from the tree and then being apprehended in a net. The bear was taken away in a trailer.

“Our staff did a great job getting the bear out of that tree,” Kowalski said.

The Ministry of Natural Resources and Forestry said the bear will be tagged and brought to a safe location about 170 kilometres away.

With files from The Canadian Press