On Tuesday, police in the city of Raleigh asked people to avoid the area around the Rex Healthcare hospital after a bear appeared in a tree.

Police said they were aware of the bear at Rex Healthcare and were working with North Carolina Wildlife Resources Commission to make sure neither the bear nor people were harmed.

Raleigh police told CBS17 the bear had been stuck up the tree since around 1 a.m. local time on Tuesday.

An official put jelly donuts and sardines out near the tree on Tuesday night in the hope of luring the bear down so it could leave on its own, CBS17 reported on Wednesday.

At around midnight on Tuesday, the bear came down from its spot. It ate some donuts before leaving the hospital grounds.

The bear ran around the tree at 12:25 a.m. on Wednesday, WRAL.com reported. Police told the outlet the bear crossed the street and they were working to ensure it was safe.

Karen Alexander, a visitor to the hospital, told CBS17: “I was telling someone earlier, at least it’s not a cobra.”

The 18-month-old bear weighing between 70 to 80 pounds was nicknamed Rex by Raleigh police, according to WRAL. The bear appeared to have abrasions caused by skin friction, most likely from a road accident.

Greg Batts of the North Carolina Wildlife Resources Commission told WRAL he bought the donuts from Krispy Kreme and squeezed the raspberry jelly out around the tree. He then used the donuts and the sardines to form a trail for the bear.

Batts said: “I threw out all this food out in the base of this tree and he’s laying up there in that tree and he’s just smelling that.

“It’s just coming up into his nostrils and [at] some point you know you just gotta say ‘I’m getting down out of here, I’m gonna grab some donuts and I’m gonna get out of town.’”

District Wildlife biologist Colleen Olfenbuttel told WRAL the biggest cause of death for bears are vehicles, and she fears Rex could be hit by a car.

Brad Howard of N.C. Wildlife told WRAL he believes the bear’s mother purposefully separated herself from it. The bear may have become confused when the sun rose, leading it to climb into a tree.

Howard said: “They don’t really understand… they just follow creeks and rivers that lead into our cities.”