A black bear peers around a branch on its perch about 100 feet off the ground in a tree near the NIH kiss-and-ride on Thursday in Bethesda. (Photo by Katherine Frey/The Washington Post)

Updated at 4:19 p.m.

The bear has two Twitter accounts of its own. It gripped the attention of bystanders for hours while Department of Natural Resources police attempted to scare it out of the tree it had climbed. And now, like our president, it is very close to being a bear on the loose.

After a young male bear was spotted in a tree on the National Institutes of Health campus, near the Medical Center Metro station, it drew a large crowd and an enthusiastic Twitter following.

More than three hours after the ordeal began, police managed to scare the bear out of the tree by firing noisemakers over its head, then to shoot it with a tranquilizer. It will now be released at McKee-Beshers Wildlife Management Area in western Montgomery County, according to Department of Natural Resources biologist Patricia Handy.

The first bear sighting of the morning was near Rockville Town Square. It may or may not be the same bear seen a few hours later at NIH.

Rockville Police Maj. Bob Rappoport said that the first bear, which he saw lumbering across a parking lot this morning, is the first he has heard about in Rockville in his 26 years on the force. Black bears are common in Frederick, though, and have been known to venture as far south as Gaithersburg regularly, Rappoport said.

He said that this bear was small — about 150 pounds, compared to the 350- to 400-pound adults he has seen in the wild — and that juvenile bears are sometimes sent away from their families to fend for themselves. This cub might have gone astray. “It’s not unusual for them, after they have babies and stuff, that the juvenile bears kind of get pushed away to live on their own,” Rappoport said. “Usually they stay where it’s not so populated, in the more rural areas.”

The Rockville bear was first seen shortly before 8 a.m. by a resident who called police to report that the animal was on Williams Street, about half a mile from Rockville Town Square. Then the phone calls started coming in from residents closer and closer to the town center, as the bear made its way toward the populated shopping district, Rappoport said.

Police officers used their cars to create barriers to keep the bear out of the town center. Once they saw that the animal was headed back into the woods where it came from, they were satisfied that it was gone. “Our primary concern in this area was to try to prevent the bear from going into the more populated area,” Rappoport said. “There’s not much we can do in terms of catching it and releasing it into the wild.”

Crowds gathered to watch a black bear spotted in a tree near the NIH. (Photo by Katherine Frey/The Washington Post)

A Maryland Natural Resources officer equipped with a tranquilizing gun and binoculars keeps tabs on a black bear in trees near the NIH. (Photo by Katherine Frey/The Washington Post)

Shortly before noon, NIH Police announced that a bear had been spotted there as well. Montgomery County Fire Department spokesman Peter Piringer pointed out that the two sightings are about eight miles apart, with some major highways in between, so it may not be the same bear. NIH security cameras have recorded bears before, Piringer said.

While police surrounded the lofty bear, which was perched about 65 feet off the ground, humorists created two Twitter accounts for it. The bear tweeted jokes like: 

Kidding aside, Rappoport advised residents to take the danger of a bear on the loose seriously. Don’t leave food out for the bear or leave trash where a bear could get into it, he said. If you see it, don’t approach it or antagonize it. Don’t try to climb a tree to evade it, because it’s surely a better climber than you are.

And if you do manage to make a bear angry? You’ll see it start pawing the ground and hear it snort, Rappoport said. “At that point, you really just want to be as big and noisy as you can. Raise your hands above your head and wave them around.”

Related: What’s that rustling in the yard? Black bears make a comeback.