Sen. John McCain, one of the senior statesmen of the GOP, said Thursday that President Obama's policies are "directly responsible" for the devastating Orlando nightclub terror attack that left 49 dead and dozens more injured.

McCain made the comments to a group of reporters in a Senate hallway and was responding a question about gun control, a particularly contentious issue since the Orlando attack, which was carried out with a legally purchased rifle. The perpetrator of the attack had pledged his allegiance to a number of Islamist terror groups, including ISIS, which is also known as ISIL.

"Barack Obama is directly responsible for it, because when he pulled everybody out of Iraq, al-Qaeda went to Syria, became ISIS, and ISIS is what it is today thanks to Barack Obama's failures," McCain said. When pressed about how the Obama was "directly responsible" for the attack, McCain doubled down on blaming the president's foreign policy.

Get Breaking News Delivered to Your Inbox

"Directly responsible because he pulled everybody out of Iraq, and I predicted at the time that ISIS would go unchecked and there would be attacks on the United States of America, it's a matter of record," McCain said, according to an MSNBC reporter. "So he is directly responsible."

McCain's comments were reminiscent of those made earlier this week by presumptive Republican presidential nominee Donald Trump. Corey Lewandowski, Trump's campaign manager, tweeted a Washington Post story about McCain's remarks Thursday afternoon.

John McCain: Obama is 'directly responsible' for Orlando attack - The Washington Post https://t.co/hjh5ry2r3B — Corey Lewandowski (@CLewandowski_) June 16, 2016

McCain later clarified his comments in a statement to the press, saying he "misspoke."

"I did not mean to imply that the President was personally responsible," McCain said. "I was referring to President Obama's national security decisions, not the President himself. As I have said, President Obama's decision to completely withdraw U.S. troops from Iraq in 2011 led to the rise of ISIL.

I and others have long warned that the failure of the President's policy to deny ISIL safe haven would allow the terrorist organization to inspire, plan, direct or conduct attacks on the United States and Europe as they have done in Paris, Brussels, San Bernardino and now Orlando."