SEOUL, South Korea — President Trump said on Tuesday that stricter gun laws would not have prevented the shooting in a Texas church that killed 26 people and that they could have driven the death toll into the hundreds, since the gunman was shot by an armed bystander.

Mr. Trump was asked during a joint news conference with the president of South Korea whether he would support “extreme vetting” of gun buyers, comparable to the vetting his administration has sought to impose on visitors from some predominantly Muslim countries.

“If you did what you’re suggesting, there would have been no difference three days ago,” the president replied, “and you might not have had that very brave person who happened to have a gun or a rifle in his truck go out and shoot him and hit him and neutralize him.”

“If he didn’t have a gun, instead of having 26 dead, you would have had hundreds more dead,” Mr. Trump said.