MANCHESTER — They came offering rooms and rides, food and drink.

They came by Twitter, harnessing social media — so often a site of anonymous derision — as a tool of collective uplift. The hashtag #RoomForManchester announced that people in the latest British city to be struck by terrorism were prepared to lend a hand to strangers.

In the hours after a bomb detonated at an Ariana Grande concert, spreading chaos as large areas around the arena were cordoned off, residents took to Twitter to offer aid to those affected by the deadly blast. The attack, which left at least 22 people dead and dozens more injured, was the deadliest in Britain since 2005 and is being investigated as an act of terrorism.

The messages, some of which gained thousands of retweets, offered a small glimmer of hope in an otherwise ghastly night of carnage, confusion and loss. And as fear and uncertainty yet again gripped Western Europe, the response from those closest to the violence suggested an unwillingness to be cowed by such strikes.

“I have a sofa, floor, blankets and tea, 5 minutes from Arena for anyone in need,” one user offered. “If you need a place to crash I live around the corner from Manchester Arena,” another wrote.

Adding to the chorus was a local Holiday Inn's guest service manager, who wrote that the hotel had spare rooms for those needing a place to stay. Several hotels in Manchester sheltered children — who made up a large share of concert-goers — as frantic parents sought to locate them. And taxis in the city's center offered free rides through the night.

Speaking early Tuesday morning, the mayor of Manchester, Andy Burnham, saluted city residents for the generosity they displayed in reacting to the attack.

“Even in the minutes after the attack, they opened their doors to strangers and drove them away from danger,” Burnham said at a news conference. “They gave the best possible immediate response to those who seek to divide us and it will be that spirit of Manchester that will prevail and hold us together.”

A Manchester city councillor, Bev Craig, wrote on Twitter that the messages showcased “the manchester I love."

Theresa May, the British prime minister, also saluted the city's munificence in her remarks to the nation outside 10 Downing Street.

“The attempt to divide us met countless acts of kindness that brought people closer together and in the days ahead, those must be the things that we remember," May said.

Acts of generosity continued through the day Tuesday. A crowdfunding campaign, sponsored by the Manchester Evening News, had raised more than £550,000 by Tuesday evening.

Sikh temples across the city opened their doors, offering food and accommodation. Many mosques, churches and other houses of worship made similar gestures. Churches were urged to do so by the bishop of Manchester, David Walker, who told Premier News that it was important to "make space for people who want to just come and find somewhere quietly to pray."

Read more: