McCain, who lost to Obama in the 2008 presidential election, spoke to reporters in the Capitol Thursday while Obama was in Orlando visiting with the families of those killed in Sunday’s attack and some of the survivors.

‘‘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,’’ McCain said in his statement, issued as his initial comments were drawing heated criticism from Democrats.

WASHINGTON — Republican Senator John McCain said Thursday that President Barack Obama is ‘‘directly responsible’’ for the mass shooting in Orlando, Florida, because of the rise of the Islamic State group on the president’s watch. But he later issued a statement saying that he ‘‘misspoke.’’


‘‘Barack Obama is directly responsible for it, because when he pulled everybody out of Iraq, al-Qaida went to Syria, became ISIS, and ISIS is what it is today thanks to Barack Obama’s failures, utter failures, by pulling everybody out of Iraq,’’ a visibly angry McCain said as the Senate debated a spending bill.

‘‘So the responsibility for it lies with President Barack Obama and his failed policies,’’ McCain said.

The gunman, Omar Mateen, killed 49 people and injured more than 50 in the attack at a gay nightclub. The 29-year-old Muslim born in New York made calls during the attack saying he was a supporter of the Islamic State. But he also spoke about an affiliate of al-Qaida and Hezbollah, both of which are IS enemies.

In the aftermath of the shooting, presumptive Republican presidential nominee Donald Trump has accused Obama of putting U.S. enemies ahead of Americans. Trump also has suggested that Obama himself might sympathize with radical elements.

Democrats criticized Trump and some Republicans tried to distance themselves from his remarks.

McCain is seeking a sixth Senate term from Arizona and is locked in a tight race. He has a Republican primary on Aug. 30 — the day after his 80th birthday — and a likely general election matchup against three-term Democratic Rep. Ann Kirkpatrick.


Questioned on his startling assertion, McCain initially repeated it: ‘‘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, so he is directly responsible.’’

However, about 90 minutes later, McCain issued his statement saying he misspoke, though his statement continued to lay blame for the attack on the president’s policies — just not on 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.’’

Democrats quickly pounced on McCain’s criticism.

Adam Jentleson, a spokesman for Senate Minority Leader Harry Reid, D-Nev., said McCain’s ‘‘unhinged comments are just the latest proof that Senate Republicans are puppets of Donald Trump.’’