President Obama rallied world leaders Friday to confront the growing threat of the Islamic State and defended his administration’s aggressive use of airstrikes against terrorist groups outside of declared war zones.

Obama said that in recent weeks the U.S. military has stepped up attacks on terrorist training camps that have killed scores of suspected fighters aligned with al-Qaeda or the Islamic State in Libya, Yemen and Somalia.

Typically, such strikes outside of war zones like Iraq, Syria and Afghanistan have been directed at suspected terrorist leaders or other “high-value targets,” Obama said. The chaos in ungoverned areas of places such as Libya and Yemen have given terrorist groups more latitude to set up training facilities.

“In some cases, we are seeing camps that after long periods of monitoring are involved in and directing plots that could do the United States harm” or are supporting the Islamic State or al-Qaeda, Obama said.

Eight countries. 2,054 nuclear tests. 70 years – mapped

Obama’s remarks came at the end of a two-day Nuclear Security Summit that brought 50 world leaders to Washington to discuss ways to prevent the spread of ­nuclear-weapons technology and ensure that dangerous nuclear material does not fall into the hands of terrorist groups or criminal networks.

The White House added a session on counterterrorism to the summit after the attacks in Brussels last week that killed 32 people and injured more than 300. The focus on terrorist networks infused other aspects of the summit, as well, as the world leaders discussed ways to prevent militant groups from obtaining nuclear materials that could be used to make a “dirty bomb” that would cause far higher levels of mass casualties.

“There is no doubt that if these madmen ever got their hands on a nuclear bomb or nuclear material, they would certainly use it to kill as many innocent people as possible,” Obama said earlier in the day. “It would change our world. . . . We cannot be complacent.”

This is the president’s fourth such summit, and he used his news conference to list some of the gathering’s accomplishments, which include removing all of the highly enriched uranium and plutonium from 50 facilities in more than 30 countries. The material was enough to build 150 nuclear weapons, Obama said. “I know that the very technical nature of nuclear security doesn’t make for flashy headlines,” he conceded.

Obama was asked to respond to comments in which Republican presidential front-runner Donald Trump suggested that Japan and South Korea should acquire nuclear weapons to defend themselves. The president admitted that Trump’s remarks had been the subject of discussion on the sidelines of the summit and called the statements ignorant and dangerous.

“They tell us that person who made the statements does not know much about foreign policy or nuclear policy or the Korean Peninsula or the world generally,” Obama said. “I have said that people pay attention to American elections. What we do is really important to the rest of the world.”

The unmistakable backdrop to the summit of world leaders was the threat posed by the Islamic State, which, even as it has lost ground in Iraq and Syria, has been able to pull off attacks in Europe, Turkey and North Africa in recent months.

The group has also spread to countries such as Libya, Afghanistan and Yemen, where Obama has responded in part by stepping up airstrikes with manned and unmanned aircraft. The president said he has pressed in his second term to institutionalize procedures designed to minimize mistakes and civilian casualties surrounding such airstrikes. Such procedures, he said, include ensuring that no women or children are in the vicinity and that the training camps are not in populated areas.

“I think there has been in the past legitimate criticism that the legal architecture around drones and other kinetic strikes wasn’t as precise as it should have been, and there is no doubt that civilians have been killed that should not have been,” he said. “Over the last several years, we have worked very hard to avoid and prevent those kinds of tragedies from taking place.

“What I can say with great confidence is that our operating procedures are as rigorous as they have ever been, and there is a constant evaluation of all we do,” Obama said.

The summit snarled traffic throughout the nation’s capital for several days and produced several notable side dramas, including an appearance at the Brookings Institution by Turkish President Recep Tayyip Erdogan in which protesters clashed with the controversial leader’s security detail.

Obama on Friday walked a careful line when criticizing a difficult but also essential ally in the fight against the Islamic State in Iraq and Syria.

“There is no doubt that President Erdogan has been repeatedly elected through a democratic process,” Obama said. “But I think the approach that they have taken towards the press is one that could take Turkey down a path that is very troubling.”

The nuclear summit was the fourth of its kind in a series launched by Obama in 2010 and aimed at ensuring the nonproliferation of nuclear weapons and reducing and securing the global stockpile of nuclear material. The White House announced a flurry of new commitments from participating nations to increase safeguards and reduce the amount of bomb-making materials.

But the summit’s ambition was tempered by the absence of Russia. Russian President Vladi­mir Putin boycotted the gathering amid tensions with the United States and other Western nations over Russia’s annexation of Crimea in Ukraine and its support of Syrian President Bashar ­al-Assad.