A bear on the loose for two days in a residential California neighborhood, at times wandering near a local elementary school, was tranquilized Friday morning, but not before passersby got very close, capturing images on their phones.

The large black bear was spotted on North Mayflower Avenue in Monrovia, about 2:30 a.m. local time, according to KTLA. At one point, the bear investigated two dogs - one large and one small - barking behind a gate, but eventually lost interest.

Video taken by passersby captured the bear nonchalantly walking the streets, presumably scrounging for food. One local reporter said Friday is the day trash cans are left out for pick-up.

Social media users were quick to warn those getting a little too close that things could take a turn for the worse.

"Hey geniuses: Get away from the bear. You can zoom on your cameras. Don't drive up to it. Don't stand in front of it. The bear is likely confused and wants no part of the commotion. If the bear feels threatened, they might attack and then could be killed," one Twitter user wrote.

Tim Daily, a spokesperson for the California Department of Fish and Wildlife, told KTLA earlier Friday that crews would first try to haze the bear, attempting to shoo it back to where it came from.

But the bear was subsequently tranquilized and set to be transported back to its natural habitat.

CLICK HERE FOR THE FOX NEWS APP

California's black bear population is conservatively estimated to be between 30,000 and 40,000, according to the California Department of Fish and Wildlife.