An adventurous raccoon who stole the headlines and captured the hearts of thousands of people worldwide who watched as it climbed to the top of a downtown St. Paul skyscraper was returned to the wild after a rooftop rescue Wednesday morning.

Two technicians from Wildlife Management Services carted away the 1-year-old female after it was caught in a trap containing wet cat food placed atop the 24-story UBS Plaza, said Christina Valdivia, general manager of the Brooklyn Park company.

The company later posted a video to Facebook of the raccoon-turned-celebrity being released “on private residential property in the southwest suburbs.”

The raccoon spent much of Tuesday perched on a narrow ledge of the building, hunkering down between the 20th and 22nd floors where it apparently stopped for a nap. Late Tuesday night, the raccoon was on the move again, dropping down to the 17th floor. It resumed its upward climb in the middle of the night.

Cameras caught it crawling into the rooftop trap around 2:30 a.m. Wednesday, bringing an end to a journey that may have been harder on onlookers than it was on the raccoon.

“We were all impressed by its ability to keep climbing,” said St. Paul Mayor Melvin Carter. “We were all nervous and scared. Glad we got a happy ending.”

Valdivia said the animal was likely drawn to the tower’s loading dock to feast on pigeon eggs when it got spooked. That’s when its “fight or flight” instinct kicked in, and the natural reaction was to start climbing.

It was around 11 a.m. Tuesday when the normally nocturnal animal was spotted stranded on the Town Square building. Maintenance workers tried to coax it down but were unsuccessful.

By midafternoon, the raccoon moved next door to the UBS Plaza and started its upward journey, using its claws to scale the columns of the pebbled concrete textured high-rise. Crowds stopped to watch and snap photos. Some posted videos, including Chelsea Palmateer, who posted on Twitter.

“Keep moving, keep moving,” she can be heard saying. “You can do it, Rocket. Oh, I’m going to have a heart attack.”

Minnesota Public Radio tweeted the drama using the hashtag #MPRraccoon. By Tuesday night the saga was the most talked-about story online, even usurping the news of the historic meeting between political adversaries U.S. President Donald Trump and North Korean leader Kim Jong Un.

Officials with St. Paul’s Department of Safety and Inspections, which includes Animal Control, thought it best to leave the raccoon alone for fear of scaring it. So they forged a plan to set a trap with wet cat food, which Valdivia called “the cream of the crop.”

“That typically gets them in,” she said.

It did.

Technicians arrived Wednesday to make the quick rescue. Valdivia said the raccoon was in good condition when caught, adding that she hoped to have it checked out at the Wildlife Rehabilitation Center in Roseville before setting it free.

Said Mayor Carter: “Somebody texted me this morning: ‘We needed this win.’ ”