AIR FORCE ACADEMY, Colo. (CBSNewYork/AP) — The Air Force said a Thunderbird jet crashed south of Colorado Springs after a flyover for a graduation of Air Force Academy cadets that was attended by President Barack Obama.

Air Force spokeswoman Lt. Col. Michal Kloeffler-Howard said Thursday the pilot ejected.

READ MORE: FDNY Probationary Firefighter Vincent Malveaux Dies After Medical Episode During Training Exercise

The Air Force’s Air Combat Command said the pilot ejected safely and “is walking around unhurt.”

The Air Force Academy told The Gazette the jet suffered engine failure before the crash.

The Gazette reported the jet crashed in a field across the street from a church.

Obama was still at the graduation site at the time of the crash, taking photos with attendees prior to returning to Washington. The crash happened about 15 miles south of the academy.

During his commencement speech, Obama implored the next generation of U.S. military leaders not to give in to isolationism or pull back from U.S. leadership in the world, drawing a contrast with a foreign policy vision that’s been laid out by Donald Trump.

Obama used his final commencement address as president to reassure the military that it remains the world’s dominant fighting force, implicitly pushing back against critiques that the military’s might has ebbed under his watch. Under searing sun and sweeping blue skies at the U.S. Air Force Academy, he told graduates they’d be called upon to strike a complicated balance between realism and idealism, withdrawal and overreach.

“We can’t be isolationists. It’s not possible in this globalized, interconnected world,” Obama said. “In these uncertain times, it’s tempting sometimes to try to pull back and wash our hands from conflicts that seem intractable, let other countries fend of themselves.”

Calling isolationism a “false comfort,” he added that history had shown how “oceans alone cannot protect us.”

Though Obama didn’t mention Trump or any other presidential candidates, his intended target was clear. Trump, the presumptive Republican nominee, has called repeatedly for putting “America first” by rethinking U.S. alliances, spending less to ensure other countries’ security and enacting strict tariffs that Trump acknowledges could potentially lead to a trade war.

Obama’s rebuke of that philosophy came the same day the likely Democratic nominee, Hillary Clinton, was launching a concerted attack against Trump’s foreign policy with a speech in San Diego. Campaign aides said that Clinton planned to assail Trump as dangerous to U.S. national security and unqualified to serve as commander in chief.

READ MORE: Columbia University Student Davide Giri Stabbed To Death, Tourist Wounded Near Morningside Park; Suspect In Custody

Though Obama has waited to start campaigning in earnest until the Democratic primary is concluded, he’s worked increasingly to undermine Trump’s appeal by attacking his policies directly and indirectly. A day earlier, Obama was in a conservative stretch of Indiana on a self-described “myth-busting” mission to derail GOP arguments on the economy.

“When we panic, we don’t make good decisions,” Obama told the Air Force Academy graduates and their families. He said that the U.S. had to engage with the world but must also be wary of overextending itself, particularly with regard to military intervention.

“We have to chart a smarter path,” he said. “As we saw in Vietnam and the Iraq war, often times the greatest damage to American credibility comes when we overreach, when we don’t think through the consequences of all of our actions.”

In another clear nod to Trump, Obama specifically mentioned the value of NATO, an alliance that Trump suggests is outdated.

Though Obama came into office pledging to end two wars and to keep the U.S. out of unnecessary entanglements, he’s repeatedly bumped into the reality of overseas messes that seem to have pulled the U.S. back in.

Nearing the end of his term, Obama is weighing whether to once again increase the number of troops he’ll leave in Afghanistan. In Iraq, troop levels have crept back up, while special forces have been dispatched to Syria and Libya. Deep concerns about Russia and China have spurred calls for a more aggressive U.S. military posture in eastern Europe and Asia.

“We have a responsibility to always give our troops a clear mission,” Obama said, along with “a plan for what comes after” the conflict.

Although he conceded that the military’s ranks have decreased — a necessity, he said — Obama insisted the U.S. armed forces are still “by a mile the strongest in the world.”

Of the 812 Air Force Academy graduates this year, 345 are going on to train as pilots, the Air Force said. Sixty of them will train to operate remotely piloted aircraft, such as drones, which have become a central tool of U.S. counterterrorism efforts under Obama. About one-quarter of the class is female.

The ceremony ended with a bang, as fighter jets in tight formation streaked across the sky over the stadium as graduates tossed their caps high in the air.

For Obama, the speech was the culmination of a yearly tradition of addressing one of the military’s four service academies at graduation. This year, Obama also delivered commencement addresses at Howard University in Washington and Rutgers University in New Jersey.

MORE NEWS: New York Weather: CBS2's 12/3 Friday Afternoon Forecast

(TM and © Copyright 2016 CBS Radio Inc. and its relevant subsidiaries. CBS RADIO and EYE Logo TM and Copyright 2016 CBS Broadcasting Inc. Used under license. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. The Associated Press contributed to this report.)