WASHINGTON — After 17 students and teachers were shot to death at a Florida high school in February, President Trump vowed to challenge both the National Rifle Association and his Republican allies in Congress by taking major action to improve school safety and impose new restrictions on guns.

In the months afterward, Mr. Trump backed down on most of those promises, telling N.R.A. members this month that their Second Amendment rights would “never ever be under siege as long as I am your president.”

On Friday, Mr. Trump once again expressed heartbreak and frustration about a deadly school shooting that killed 10 people at a high school in Santa Fe, Tex., and said his administration would do “everything in our power” to keep guns away from those who should not have them.

“This has been going on too long in our country — too many years, too many decades now,” Mr. Trump said in the East Room of the White House, where he was making remarks on prison overhaul. He pledged to “protect our students, secure our schools, and to keep weapons out of the hands of those who pose a threat to themselves and to others.”