The marmot was captured at Alvarado Elementary School at 625 Douglass St., according to Rebecca Dmytryk, an animal expert with the Moss Landing-based organization Wildlife Emergency Services.
The animal had initially been spotted on June 26 in Bernal Heights but recuers were not able to capture it and sightings stopped a few weeks ago, Dmytryk said. Some of the sightings were in backyards on Bocana Street.
On Wednesday, a San Francisco Animal Care and Control officer was called to the school after the marmot was seen running out from under the hood of a car. He called Wildlife Emergency Services for help in identifying the animal, which he described as a mix between a ground squirrel and prairie dog, Dmytryk said.
The officer was notified that it was a yellow-bellied marmot, and he was eventually able to capture it and bring it back to Animal Care and Control headquarters around 8:30 p.m., agency spokeswoman Deb Campbell said.
The animal is in good health and has been eating apples, Campbell said.
Staff members have noticed that the marmot has been whistling, Campbell said. She noted that the animals are nicknamed "whistle pigs."
"He's relaxing and waiting for his ride back to the Sierras," she said.
Dmytryk said a rescuer from her organization is picking up the marmot and taking it to the Wildlife Center of Silicon Valley in San Jose for an examination.
The animal is then scheduled to be taken home to Yosemite on Saturday.
Dmytryk said yellow-bellied marmots are usually found at elevations of 6,000 feet or higher, but are often unwittingly transported elsewhere because "they're notorious for going up under hoods of cars after sweet-smelling radiator fluids."
She said the San Francisco marmot likely came to the city in similar fashion and appears to have also traveled to the Noe Valley school in an engine compartment.
Eyewitnesses said that on Wednesday afternoon, the animal popped out from under the hood of a car and ran onto school grounds. The car had been driven from the city's Mission District, about half a mile from where the marmot had last been seen, Dmytryk said.
She said the goal is to get the marmot back up into a mountainous region in time for winter, when the species hibernates.
"Hopefully we'll get him back in time for hibernation ... and can store up food and find a place for shelter over the winter," she said. Dmytryk thanked the media for helping rescuers develop leads about the marmot's location as well as where it came from.
The animal even has its own Twitter page created by a devotee. The profile bernalmarmot appeared after the initial sightings in Bernal Heights, with new tweets posted since news of the animal's capture.
"It's been a good run. They let me keep my iPhone which was nice," a tweet said.
Another added, "This Animal Care and Control Hotel is pretty nice. It even has free WiFi."
Rock Bar in San Francisco is helping to raise funds to offset travel expenses for the marmot. On Saturday from 4 to 9 p.m., a percentage of the sales of Marmotinis -- a specially crafted cocktail made to resemble radiator fluid in honor of the marmot -- will go to Wildlife Emergency Services.