The US should prioritise funding for school security over aid to Ukraine, former President Donald Trump has said days after 19 Texas pupils were killed.

If the US can send billions to Ukraine, “we should be able to do whatever it takes to keep our children safe at home”, he said at a pro-gun conference.

The meeting of the National Rifle Association (NRA), the largest US gun group, is taking place in Houston.

It comes three days after a mass shooting by a teenager in Uvalde.

“We spent trillions in Iraq and Afghanistan, and got nothing for it,” Mr Trump continued in Friday’s speech, drawing loud applause.

“Before we nation-build the rest of the world, we should be building safe schools for our own children in our own nation.”

Earlier this month, the US Congress overwhelmingly voted to send nearly $40bn (£31bn) in military aid to Ukraine. In total, US lawmakers have sent about $54bn to Ukraine since Russia invaded in February.

Mr Trump rejected calls for tightened gun controls, saying decent Americans should be allowed firearms to defend themselves against “evil”.

He instead proposed a “top-to-bottom overhaul” of school safety, with fortified single points of entry including metal detectors and at least one armed police officer on every campus. He accused Democrats of stonewalling such security measures.

The former Republican president began his speech by reading out the names of the Uvalde shooting victims, with each marked by a bell toll.

The annual conference of the NRA, which boasts of five million members, is taking place 280 miles (450 km) from Uvalde, the scene of the worst school shooting in the US in a decade.

Ahead of the event, several conservative speakers and musical performers announced they were backing out – including Texas Governor Greg Abbott, Senator John Cornyn and the manufacturer of the rifle used in the Uvalde attack.

Mr Trump also called in his speech for the US to “drastically change our approach to mental health”.

He made a similar call during his presidency, even while critics at the time accused him of trying to defund medical programmes that included mental healthcare.

Before Mr Trump spoke, Texas Senator Ted Cruz blamed mass shootings mainly on absent fathers, declining church attendance, social media and video games.

Outside the venue, hundred of protesters gathered to oppose the NRA. They held signs saying “NRA kill kids”, “protect children not guns” and held crosses and photos of shooting victims.

“The only way to stop a bad guy with a gun, is a good guy with a gun,” Donald Trump told the NRA convention in Houston on Friday night.

It is a familiar phrase among pro-gun advocates who insist that more guns, not fewer, are needed to tackle armed violence in America.

Trump also repeated the same themes I’d heard from NRA members outside the hall – they say the focus should be on mental health issues that drive people to carry out mass shootings – not the weapons they use

After reading out the names of all 21 victims of the Uvalde school massacre, the former president said “the existence of evil is one of the very best reasons to arm law-abiding citizens…. not disarm them.”

He went on to accuse Democrats of politicking a tragedy by advocating greater gun control legislation.

Several other politicians and performers pulled out the event that being held less than 300 miles from Uvalde. Trump took a swipe at them too – saying: “And unlike some I didn’t disappoint you by not showing up.”