President Donald Trump said that children who are afraid of going back to school after two mass shootings last weekend should "really study hard" and "someday you'll grow up and maybe be president of the United States, or do something else that's fantastic."

"They have nothing to fear, nothing to worry about," Trump said, adding, "I think we have a very good system right now, but that doesn't mean that there's not going to be some crazy person. But that's what we want to do — we want to take the guns out of the hands of crazy, demented, sick people."

The president's remarks came after the mass shootings in Dayton, Ohio, and El Paso, Texas, that left 31 dead and several injured.

Visit Business Insider's homepage for more stories.

President Donald Trump said on Friday that children who are afraid of going back to school in the wake of two mass shootings should "really study hard" and "someday you'll grow up and maybe be president of the United States, or do something else that's fantastic."

"They have nothing to fear, nothing to worry about," Trump added, in response to a question from a reporter before he left the White House to head to his golf club in New Jersey.

The president's comments came after two back-to-back mass shootings in Dayton, Ohio, and El Paso, Texas, over the weekend. Thirty-one people were killed and several were injured.

Trump said on Friday that the White House was in "constant contact" with state governments and that "they are really doing a great job."

Read more: Trump calls Hollywood 'racist' as a satirical film that depicts liberal elites hunting 'deplorables' for sport is set for release

He also took a jab at former President Barack Obama, saying the current situation is "so much better than it was 2 1/2 years ago."

"I think we have a very good system right now," Trump said, "but that doesn't mean that there's not going to be some crazy person. But that's what we want to do — we want to take the guns out of the hands of crazy, demented, sick people."

Law-enforcement officials have not yet determined the motive behind the Dayton shooting. Authorities suspect that the El Paso shooter was fueled by anti-immigrant rage after they discovered a racist manifesto he posted online shortly before carrying out the attack, in which he echoed much of the president's incendiary rhetoric toward immigrants.

There is no evidence that either of the suspects had a history of mental illness.