Media playback is unsupported on your device Media caption The animal had been scaling the UBS building since Tuesday morning

A daredevil raccoon has been safely rescued after leaving the internet on tenterhooks by scaling a 23-floor building in St Paul, Minnesota.

The critter, dubbed #MPRraccoon after the radio station opposite the high-rise, trended worldwide on Twitter.

Crowds gathered at the building after it went viral, and local media streamed its perilous climb for almost a day.

Twitter celebrated as it reached the roof at 03:00am (08:00 BST) where cat food was waiting inside a trap.

The raccoon has been collected by animal welfare and will be released later.

Evan Frost and Tim Nelson, journalists with Minnesota Public Radio (MPR), documented the raccoon's nerve-wracking journey on Twitter.

"One of my colleagues spotted the raccoon on, kind of the ground floor, sitting on a ledge on Monday - it looked like a brown lump, almost like a cat sitting there," Evan Frost told the BBC in the early hours of Wednesday.

Image copyright Tim Nelson/ MPR News Image caption Watchers were concerned for the animal's welfare, and feared he needed food and water

"We went out there at about 8:30 on Tuesday morning and saw it was a raccoon. Two workers in the building got out a couple of long planks - sort of making a kind of ladder for it."

But that initial rescue failed - and ended up scaring the animal upwards.

It spent much of Tuesday going up and down the building's floors, occasionally napping on ledges.

Before its final ascent to the roof, it had been slowly making its way down, as an anxious audience watched on into the night.

"It was heartbreaking to see yesterday," Tim Nelson told the BBC on Wednesday. "We couldn't imagine how this would end well for him".

Image copyright UBS Plaza/Twitter Image caption The raccoon has since been captured and fed by local Wildlife Management

It has not been confirmed locally if the raccoon is a male or female.

Raccoons are common in the US, but are usually found in alleys or riffling through rubbish bins - leading to the common animal nickname "trash panda".

"I was talking to a wildlife expert yesterday who said there might be a dozen or two dozen of these raccoons in every square mile here in Minnesota - they're everywhere. But you don't see them scaling office towers," Mr Nelson said.

Image copyright Tim Nelson/ MPR News Image caption The building's windows were sealed, and local fire officials said it was too dangerous to attempt a human rescue

Both men were overwhelmed by the global reaction to their posts about the raccoon's ascent.

"I think it just seems like something a lot of different people can get behind," Mr Frost told the BBC.

"It's kind of absurd that I took a couple of pictures of an animal that people usually hate and think is disgusting, and all of a sudden it has thousands of retweets and likes."

You may also like:

Mr Nelson grew up in a town called Coon Rapids, named after the mammals.

"To think that one of these little animals would top the trending on Twitter is a complete surprise to me," he said.

Image copyright Evan Frost/ MPR News Image caption Crowds gathered throughout Tuesday day and overnight at the scene

Image copyright Tim Nelson/MPR News Image caption One woman, Mary Lucia, brought binoculars, and said she was worried about the animal on Tuesday

Both men laughed when asked if they had managed to get any work done during raccoon-watch.

Although the animal was filmed reaching the top shortly before 03:00 local time - it was not officially confirmed safe until five hours later when it was officially found safe inside the trap.

The animal has become an unlikely hero for many on Twitter - with users dubbing his unlikely success an inspiration.

James Gunn, who directed Hollywood film Guardians of the Galaxy, which featured a hero raccoon, at one point on Tuesday offered to donate $1,000 (£750) to charity in the name of anyone who was able to save the #MPRraccoon.

A Twitter account in the animal's name already has over 2,500 followers - and users online have made fan-art and even toys of the animal.