BOSTON — Secretary of State John Kerry told college graduates Friday that their diversity is “Donald Trump’s worst nightmare” and that it’s their job to stop the spread of violent extremism.

Speaking to an estimated audience of 25,000 at Northeastern University’s commencement, Kerry drew heavy applause when he noted the many races and religions among the graduates, and then directed a jab at the presumptive Republican presidential nominee.

“You really do look spectacular,” Kerry said. “I want you to just look around you. Classmates from every race, religion, gender, shape, size. Eighty-five countries represented and dozens of languages spoken. You are the most diverse class in Northeastern’s history. In other words, you are Donald Trump’s worst nightmare.”

Trump has angered many with comments he has made about Hispanics and Muslims, among other groups. He backs building a wall along the U.S.-Mexico border and wants to deport the millions of people in the United States illegally. He has also proposed banning Muslims from entering the United States.

The Democratic secretary of state assured graduates that the United States and its allies are winning the battle against extremists in Iraq and Syria. But he added that the United States won’t be successful in the long run if the world continues to turn away from other problems that fuel the production of terrorists at what he said is an “alarming” rate.

“Your mission is to make jobs not just in a few places but many places,” he said. “Doing this is not about charity, it’s not about giving something for nothing. It’s about building our own security and preventing the conflicts of the future.”

Kerry praised the work of President Obama’s administration on climate change and public health, but he called on graduates to go further.

He called climate change “one of the greatest challenges of our time.” He added that the global agreement on climate change reached in Paris last year is only the start of the solution.

“Last March was the hottest March in recorded history. Last year was the hottest year in recorded history,” he said. “The facts are simply staggering.”

Kerry, who became secretary of state in 2013, was a longtime U.S. senator from Massachusetts and a prosecutor in the state. He earned a law degree from Boston College in 1976 after graduating from Yale University. He previously delivered the commencement address at Northeastern in 2000.

Kerry described a world filled with challenges. He drew on the spread of the Zika virus, the wide gap between rich and poor, and the 2013 Boston Marathon bombings.

“Boston and Northeastern need no lesson in how important it is to win the battle against terrorists,” he said. “There can be no peace without eliminating this scourge.”

But he added that the graduates have the education and character to confront those challenges, and he urged them to play a role in the global community. He ended on an optimistic note, paraphrasing former South African President Nelson Mandela: “All the hardest jobs seem impossible until they are done.”

Comments are not available on this story.