Britain has raised its terror threat level from severe to critical in the wake of last night's attack at Manchester Arena and Prime Minister Theresa May warned that further attacks may be imminent.
In a statement at Downing Street, Mrs May denounced the appalling cowardice of suicide bomber Salman Abedi.
She said: "The spirit of Manchester and the spirit of Britain is far mightier than the sick plots of depraved terrorists.
"That is why the terrorists will never win and we will prevail."
Mrs May said the terror threat level would be increased to "critical", meaning an attack was expected imminently as it was possible a "wider group of individuals" could have been involved in the attack rather than just Abedi.
In a sign of the increased threat, the military could be deployed to support armed police officers, Mrs May said.
Soldiers will replace armed police at many sites, freeing them up for patrols in key areas under Operation Temperer.
Mrs May said in her statement: "You might also see military personnel deployed at certain events, such as concerts and sports matches, helping the police to keep the public safe. In all circumstances, members of the armed forces who are deployed in this way will be under the command of police officers."
The way that members of the armed forces are deployed will be a matter for police commanders.
Twenty-two people died in the attack and 59 were hurt, many with life-threatening injuries. Twelve of those taken to hospital were children.
The youngest victim was named as eight-year-old Saffie Roussos.
A number of people remain unaccounted for.
Mrs May said: "The work undertaken throughout the day has revealed that it is a possibility we cannot ignore that there is a wider group of individuals linked to this attack.
"This morning I said that the Joint Terrorism Analysis Centre, the independent organisation responsible for setting the threat level on the basis of the intelligence available, was keeping the threat level under constant review.
"It has now concluded, on the basis of today's investigations, that the threat level should be increased for the time being from severe to critical.
"This means that their assessment is not only that an attack remains highly likely, but that a further attack may be imminent."
It is the first time that Operation Temperer, which was first revealed in 2015, has been put into effect.
The plan is believed to allow up to 5,000 troops to be deployed in support of the police.
But military assets have been used to protect against the terrorist threat before, including in February 2003 when troops were drafted in to Heathrow, with armoured vehicles patrolling amid fears that extremists could be on the loose with a surface-to-air missile launcher.
Britain's senior counter-terrorism officer said Operation Temperer would allow police to "stretch our armed capability".
Met Police Assistant Commissioner Mark Rowley said the first phase would allow soldiers to replace police officers at fixed locations but after that they could "augment our patrols" at sites such as transport hubs and major events.
"There are many big events across the country over the next couple of weeks, we are going to be working really closely with the organisers to review the security, review their stewarding arrangements, review our policing arrangements and make sure that decisions are taken that events only go ahead when it's sensible and safe to do so," he said.
Mr Rowley acknowledged it was "unusual" but added: "This is professional and well thought through. For this brief period, while we have these lines of inquiry to accelerate and to pursue, we can protect and reassure the public with this stance across the country."
Thousands gather in solidarity for Manchester victims
Earlier, thousands of people gathered in the centre of Manchester in a show of defiance, declaring they will not be "beaten" or "intimidated" in the wake of the attack.
Crowds spilled from Albert Square on to nearby roads, standing together in an act of solidarity and applause broke out as the vigil began.
Senior political figures including Home Secretary Amber Rudd, Labour leader Jeremy Corbyn and Speaker John Bercow joined Manchester Mayor Andy Burnham on stage.
Lord Mayor of Manchester Eddy Newman said the vigil was a chance to "express solidarity" with the victims.
He thanked the emergency services, prompting a rapturous response from the thousands of people gathered there.
Addressing the crowd, Greater Manchester Police Chief Constable Ian Hopkins said: "As your Chief Constable of Greater Manchester and as a father I cannot begin to imagine how anyone can carry out such an unthinkable act - murdering 22 people and injuring 59 - and my thoughts and those of my colleagues are very much with their families at this incredibly difficult time."
He added: "Last night, in the most atrocious circumstances, the people of Greater Manchester showed the world how much we care.
"How much we care about each other and how much we were prepared to help those in need.
"And I've heard some tremendous stories of doctors coming in to support and police officers, ambulance workers giving up their days off turning up to help those in need."
- As it Happened: Manchester Arena attack
- What we know so far
- First victims named
- In pictures: Manchester blast aftermath
People flee Manchester Station after 19 killed in terrorist attack at Ariana Grande concert pic.twitter.com/3Tws9aWCJJ— RTÉ News (@rtenews) May 23, 2017
Mr Hopkins thanked those who had worked "tirelessly" through the night, "members of the public for their solidarity" and "the rest of the world for holding us in their thoughts".
"We must all stand together and not let the terrorists defeat us, not let them stop us going about our daily business and create fear and we must all live in harmony with each other as we stand together and defeat terrorism," he said.
May to lead anti-terror discussions at G7
Mrs May will lead discussions on tackling terrorism at a meeting of premiers from leading economies later this week, Downing Street has said.
Mrs May is continuing with plans to attend the G7 in Sicily after a Nato gathering in Brussels.
Counter-terrorism dominates the agenda for the Sicilian summit and the focus will be on international cooperation to "tackle a shared threat".
G7 nations gather for two days of discussions.
"Nato has a key role to play in counter-terrorism," the spokesman added.
British-Libyan named as man behind attack
The suspected Manchester bomber has been named as Salman Abedi.
Police confirmed his name after armed officers carried out a raid on a redbrick semi in south Manchester where the 22-year-old was registered as living.
Chief Constable Hopkins said detectives were working to establish whether Abedi, was working alone.
Mr Hopkins said: "I can confirm that the man suspected of carrying out last night's atrocity has been named as 22-year-old Salman Abedi.
"However, he has not yet been formally identified and I wouldn't wish, therefore, to comment further.
"The priority remains to establish whether he was acting alone or as part of a network."
Abedi was born in the city and is believed to be of Libyan descent.
Police had executed warrants in the districts of Whalley Range and Fallowfield, where a house on Elsmore Road was raided as part of the investigation.
Greater Manchester Police said in a statement: "With regards to the ongoing investigation into last night's horrific attack at the Manchester Arena, we can confirm we have arrested a 23-year-old man in South Manchester."
Counter-terrorism agencies have mounted a major operation to establish the circumstances of the attack and the bomber's background.
Andrew Parker, the Director General of MI5, said everyone at the agency "is revolted by the disgusting terrorist attack".
He added: "Our hearts go out to the families of the victims, the injured and everyone affected by it.
"Our teams have been working with the police through the night to assist the investigation.
"We remain relentlessly focused, in numerous current operations, on doing all we can to combat the scourge of terrorism and keep the country safe."
Taoiseach Enda Kenny said: "The vile acts carried out in Manchester last night are a reminder of the depravity of the views held by the few. Those beliefs have no place in our society."
My thoughts and prayers are with the victims, their families and all those affected by this atrocity. I am heartbroken for all
Minister for Foreign Affairs Charlie Flanagan said his department is not aware of any Irish citizens affected. Anyone with concerns for family and friends can contact the Consular Division of his department on 353 1 408 2000.
'Huge blast' felt as concert ended
Police responded to reports of an explosion shortly after 10.33pm at the arena, which has the capacity to hold 21,000 people.
A witness who attended the concert said she felt a huge blast as she was leaving the arena, followed by screaming and a rush by thousands of people trying to escape the building.
A video posted on Twitter showed fans, many of them young, screaming and running from the venue.
Social media footage shows chaos at Ariana Grande concert in Manchester arena pic.twitter.com/1sv2y1hdAR— RTÉ News (@rtenews) May 23, 2017
Chief Constable Hopkins said in a statement in the early hours of this morning: "This has been the most horrific incident we have had to face in Greater Manchester and one that we all hoped we would never see.
"We have been treating this as a terrorist incident and we believe at this stage the attack last night was conducted by one man. The priority is to establish whether he was acting alone or as part of a network.
"The attacker, I can confirm, died at the arena. We believe the attacker was carrying an improvised explosive device which he detonated causing this atrocity."
Ariana Grande, who was unhurt, later said on Twitter: "broken. from the bottom of my heart, i am so so sorry. i don't have words."
broken.— Ariana Grande (@ArianaGrande) May 23, 2017
from the bottom of my heart, i am so so sorry. i don't have words.
US officials drew parallels to the coordinated attacks in November 2015 by Islamist militants on the Bataclan concert hall and other sites in Paris, which claimed about 130 lives.
Manchester Arena, the largest indoor arena in Europe, opened in 1995 and is a popular concert and sporting venue.
Britain is on its second-highest alert level of "severe", meaning an attack by militants is considered highly likely.
Update from RTÉ's London Correspondent Fiona Mitchell
The suspected bomber has been named as Salman Abedi. It is understood his parents left Libya in the 1990s and sought refugee status in the UK and that initially they settled in London before eventually moving to the Manchester area, where Abedi was born.
The focus now for security officials will be what other associations he may have had in Manchester and in other parts of the UK.
There is still some uncertainty as to what has happened to some people who were at the concert last night.
The injured were taken to hospitals around Manchester and in other areas, and if they have not yet been in a position to tell authorities who they are, if their medical condition prevents that, it means it is difficult to identify everyone who may have been caught up in the attack.
Investigators are looking at how the attack actually happened; how Salman Abedi actually managed to get into Manchester Arena last night.
And the focus now becomes the idea of Manchester Arena as a "soft target", as this bomber managed to get through to the foyer area and got through before any bags or security checks.
Parents and friends search for loved ones
Desperate parents and friends used social media to search for loved ones while the wounded were being treated at six hospitals across Manchester.
"Everyone pls share this, my little sister Emma was at the Ari concert tonight in #Manchester and she isn't answering her phone, pls help me," said one message posted alongside a picture of a blonde girl with flowers in her hair.
Paula Robinson, 48, said she was at the train station next to the arena with her husband when she felt the explosion and saw dozens of teenage girls screaming and running away from arena.
"We ran out", Ms Robinson told Reuters. "It was literally seconds after the explosion. I got the teens to run with me."
She took dozens of teenage girls to the nearby Holiday Inn Express hotel and tweeted out her phone number to worried parents, telling them to meet her there. She said her phone had not stopped ringing since her tweet.
Parents were frantic running about trying to get to their children.
"There were lots of lots children at Holiday Inn."
Concert-goer Catherine Macfarlane said: "We were making our way out and when we were right by the door there was a massive explosion and everybody was screaming."
It was a huge explosion - you could feel it in your chest. It was chaotic. Everybody was running and screaming and just trying to get out.
A witness told the BBC he saw 20 to 30 people on the ground.
The man, named Andy, said he was blown "about 30ft" by a blast that shook the building as he waited to collect his wife and daughter at the end of the concert.
He told BBC News: "It's shocking what happened. Just carnage everywhere. There was a good 20 to 30 of them [victims]. Some were young kids, some were disabled people."
Andy said he helped emergency services treat the wounded who were "scattered" by a blast near a box office.
He said he later found his family outside the arena.