US Sen. John McCain on a visit at a migrant center near the village of Adasevci, Serbia. Thomson Reuters Sen. John McCain on Thursday delivered and quickly walked back comments saying President Barack Obama was "directly responsible" for the terrorist attack on an LGBTQ nightclub in Orlando, Florida, earlier this week.

The Republican senator from Arizona reportedly argued that Obama was to blame for the shooting that left 49 people dead because his administration's Middle East policy led to the rise of the terrorist group ISIS.

"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, according to The Washington Post.

McCain made the remarks to a small group of reporters in a Senate hallway, according to the Post. His comments were made in response to a question about gun control.

Later in the afternoon, McCain released a statement saying he "misspoke":

"I misspoke. I did not mean to imply that the President was personally responsible. 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."

The gunman who carried out the Orlando attack, a US citizen, pledged allegiance to ISIS in phone calls and Facebook posts made during the attack.

Senate Minority Leader Harry Reid's office quickly issued a statement condemning McCain's comments.

"Senator McCain's unhinged comments are just the latest proof that Senate Republicans are puppets of Donald Trump," said Adam Jentleson, Reid's deputy chief of staff.

"This is the party of Trump," he added.