WASHINGTON — President Donald Trump lamented the "hate in our country" and condemned anti-Semitism after the killing of 11 people in a lone gunman's shooting rampage at a Pittsburgh synagogue Saturday and asserted that better security at the congregation could have prevented the massacre.

"They had a maniac walk in and they didn't have any protection and that is so sad to see," Trump said at Joint Base Andrews in the Maryland suburbs before he departed for a campaign swing in the Midwest. "If you take a look at it, if they had protection inside the results would have been far better."

Trump's suggestion was similar to his proposal after February's school shooting in Parkland, Florida, that schoolteachers should be armed.

He also placed the shootings in the context of a long series of violent acts nationally and globally.

"It's a terrible, terrible thing what's going on with hate in our country, frankly, and all over the world," the president said. "It's a violent world. You think when you're over it, it just goes away but then it comes back in the form of a madman, a wacko."

Later, at a Future Farmers of America conference in Indianapolis, Trump said the nation and the world are "shocked and stunned" by the "anti-Semitic act" in Pittsburgh — one of several references he made to anti-Semitism.

"You wouldn't think this would be possible in this day and age, but we just don't seem to learn from the past," he said, noting that the shootings took place during a baby-naming ceremony at the synagogue. "There must be no tolerance for anti-Semitism in America or anywhere."

Trump arranged for a pastor and a rabbi to lead the conference in prayers.

U.S. President Donald Trump hugs Rabbi Benjamin Sendrow and Pastor Thom O'Leary after they both led prayers at the 91st Annual Future Farmers of America Convention and Expo, in Indianapolis on Oct. 27, 2018. Al Drago / Reuters

Aboard Air Force One, before he arrived in Indianapolis, Trump told reporters he was considering cancelling a "Make America Great Again" campaign rally scheduled for later Saturday in Illinois. But by the time he spoke to the FFA group, he had decided to go ahead with the political event.

"At first, I was thinking 'I'll cancel' and then I said we can't let evil change our life and change our schedule," Trump said. "Otherwise, we give them too much credit, we make them too important."

Comparing his decision to the reopening of the New York Stock Exchange following the Sept. 11, 2001, terrorist attacks on the U.S., Trump said he felt duty-bound to hold the rally.

"You go with a heavy heart but you go," he said. "Not that I want to go. But I think, actually in reverse, (I) have an obligation to go."

Trump urged Americans to "come together" in the wake of the shootings.

But later in his speech, he took swipes at House Minority Leader Nancy Pelosi, D-Calif., and Sen. Elizabeth Warren, D-Mass.

In praising Republican congressmen, Trump said he wouldn't talk about their Democratic opponents.

"I won’t tell you that they’re aligned with Nancy Pelosi," he said. "I’m going to be nice."

And, as he often does at campaign rallies, he reminded the audience that Warren's recent DNA test showed that she has relatively little Native American ancestry — a point he has dwelled on as he has ridiculed her for identifying herself as Native American on university personnel forms many years ago.

Before his rally in Murphysboro, Ill., Saturday night, Trump said that he planned to tone down his usual campaign event remarks. But his speech was full of attacks on familiar foils, including Warren, Pelosi and Rep. Maxine Waters, D-Calif. And he picked on a new target: Conservative journalist and pundit Bill Kristol, a frequent Trump critic.

He called Kristol one of the "losers" who has opposed him and, at length, mocked the Weekly Standard editor at large for his inaccurate prognostications during the 2016 campaign.

"Some guy named Bill Kristol," Trump said. "He called it wrong from Day One."

Police arrested the suspect, Robert Bowers, 46, of Baldwin, a borough south of Pittsburgh, and he was charged with 29 federal counts Saturday night, officials said. Four police officers were injured in the shooting, according to Wendell Hissrich, the city's public safety director, who spoke at a news conference.

Trump also said that the death penalty should be more swiftly applied to mass murderers.

"I think they should stiffen up laws, and I think they should very much bring the death penalty into vogue," he said.

Asked by reporters about his close relationship with the National Rifle Association, Trump stressed his view that having armed guards at the synagogue might have made a difference — and said it might be necessary to have them at all houses of worship in the United States.

"I hate to think of it that way," the president said. "It's certainly an option."

He said that he will travel to Pittsburgh but declined to elaborate on when he'll make the trip.

Vice President Mike Pence also addressed the murders during an appearance in Las Vegas.

"What happened in Pittsburgh today was not just criminal, it was evil," Pence said, adding praise for the "swift response" of law enforcement. "There is no place in America for violence or anti-Semitism."

Pence asked all Americans to pray for those killed or injured in the shooting and their families.