US President Joe Biden has said that he would soon go to Texas in the wake of the deadly shooting at an elementary school that left 19 students and two teachers dead.

"Jill and I will be travelling to Texas in the coming days to meet with the families and let them know we have a sense, just a sense of their pain," he said at the White House, adding he hoped to offer comfort to "a community in shock and grief."

Earlier, he said that the United States needs to stand up to the gun lobby after the mass shooting at the school.

Authorities said an 18-year-old boy opened fire at Robb Elementary School in Uvalde, south Texas, before he apparently was killed by police officers.

"I hoped when I became president I would not have to do this, again," a visibly shaken Mr Biden said, decrying the death of "beautiful, innocent" second, third, and fourth-graders in "another massacre".

Their parents "will never see their child again, never have them jump in bed and cuddle with them", he said.

"There's a hollowness in your chest, and you feel like you're being sucked into it and never going to be able to get out," he said.

"It's suffocating, and it's never quite the same.

"As a nation, we have to ask: 'When in God's name are we going to stand up to the gun lobby?'

"We have to act," he said, and suggested reinstating the assault weapons ban and other "common sense gun laws".

"To lose a child is like having a piece of your soul ripped away," said Mr Biden, who has often spoken about death of his infant daughter Naomi in a 1972 car crash, which also took the life of his first wife Neilia.

He has also publicly mourned the death of his eldest son Beau to brain cancer aged 46 in 2015.

Law enforcement officers gather outside Robb Elementary School following the mass shooting

Turning to his wife as he delivered his remarks in the White House, Mr Biden said: "The Lord is near to the brokenhearted and saves the crushed in spirit,' So many crushed spirits.

"So, tonight, I ask the nation to pray for them, to give the parents and siblings the strength in the darkness they feel right now."

"Our prayer tonight is for those parents, lying in bed and trying to figure out, 'Will I be able to sleep again? What do I say to my other children? What happens tomorrow?'"

A mass shooting in a Buffalo, New York, supermarket ten days ago increased pressure from backers of tougher gun laws for the Biden administration to make good its vow to crack down on gun violence.

When he ran for the White House, Mr Biden promised to push gun safety measures and reduce the country's tens of thousands of annual gun deaths.

He and his fellow Democrats have failed to get enough votes in Congress for background checks for gun purchases or other proposed bills.

We need your consent to load this rte-player contentWe use rte-player to manage extra content that can set cookies on your device and collect data about your activity. Please review their details and accept them to load the content.Manage Preferences

The United States is the most heavily armed society in the world, according to the Geneva-based Small Arms Survey, a research group.

Small, rural states where gun ownership is widespread have disproportionate influence in the US Senate, where a supermajority of 60 votes is needed to advance most legislation in the 100-seat chamber.

Mr Biden was briefed about the shooting aboard Air Force One as he returned from a trip to Asia, White House press secretary Karine Jean-Pierre said on Twitter.

He called Texas Governor Greg Abbott to offer any assistance needed.

"His prayers are with the families impacted by this awful event," Ms Jean-Pierre said.

In a proclamation issued before he landed, Mr Biden ordered the flags at the White House and at US federal and public buildings to be flown at half-mast until sunset on 28 May.

Taoiseach Micheál Martin offered his "heartfelt sympathies" to the families of those killed at Robb Elementary School, which he said was an "appalling and shocking tragedy".

Minister for Foreign Affairs Simon Coveney also offered his condolences, describing what happened as "shocking violence".

Pope Francis said he was "heartbroken" by the shooting, where those attending his weekly general audience in St Peter's Square applauded his appeal.

"I am heartbroken by the massacre at the elementary school in Texas. I pray for the children and the adults who were killed and for their families," Pope Francis said.

"It is time to say 'enough' to the indiscriminate trafficking of weapons. Let us all make a commitment so that tragedies like this cannot happen again," he said.

French President Emmanuel Macron said France shared Americans' anger over the school shooting in Texas.

"We share the shock and grief of the American people, and the rage of those who are fighting to end the violence," Mr Macron said on Twitter.

US Ambassador to Ireland Claire Cronin said there is "nothing more horrifying" than the thought of children not being able to go to school safely.

Speaking on RTÉ's News at One, Ms Cronin said gun laws "do work" and she is optimistic about changes, but she was frustrated that America has not addressed gun issues "in the manner that we should".

"We've seen this over and over and over again, I don't know what it will take," she said.

"The idea of children being slaughtered in their classroom – I can't imagine that we should need any more than that."