NEW LONDON, Conn. — An embattled President Trump used his first commencement address to a military academy as president to defend himself on Wednesday, telling graduating Coast Guard cadets that no leader in history has been treated more “unfairly” by the news media and Washington elites — and he signaled that will hunker down for a lengthy fight.
Mr. Trump began his speech at the Coast Guard Academy with a tribute to the service’s efforts to stop drug dealers on domestic waterways and the open seas. But he quickly toggled to himself, after a week of damaging disclosures capped by the revelation on Tuesday that he pressured the former F.B.I. director James B. Comey to drop his investigation into possible collusion between the president’s first national security adviser and Russia.
“You will find things are not always fair,” said Mr. Trump, blurring the lines between an inspirational, forward-looking commencement speech and talk about himself, much as he did at a commencement address to students at Liberty University in Virginia on Saturday.
The podcast that makes sense of the most delirious stretch of the 2016 campaign.
“You have to put your head down and fight, fight, fight,” Mr. Trump said, offering his personal credo, before switching to an explicit theme of self-defense. “Look at the way I’ve been treated lately, especially by the media. No politician in history, and I say with surety, has been treated worse, more unfairly.”
When the audience applauded, Mr. Trump — whom aides have described as frustrated and defiant as controversy has engulfed the White House in recent days — smiled and told people to stand by their beliefs.
“You can’t let them get you down. You can’t let the critics and the naysayers get in the way of your dreams,” he said.
“I guess that’s why I won,” Mr. Trump added.
It was the president’s first public appearance since The New York Times reported on Mr. Comey’s memo about his meeting with the president on Feb. 14, a day after Lt. Gen. Michael T. Flynn was pushed out as Mr. Trump’s national security adviser.
Mr. Trump did not wave to reporters as he boarded Air Force One for his flight to Connecticut. But he appeared with a smile and a salute as he walked along a processional to the dais at the Coast Guard Academy’s football field.
Presidents have often used speeches to the nation’s service academies to lay out important foreign policy principles.
In 2002, in the aftermath of the Sept. 11 attacks, President George W. Bush used a commencement speech at the United States Military Academy to declare his policy of pre-emption, under which the United States pledged to attack any country that posed a critical threat to the American homeland.
In 2014, also at West Point, President Barack Obama told graduating cadets that the United States would rely on local partners to fight counterinsurgency wars in places like Afghanistan and Iraq, rather than committing large numbers of American troops.
Mr. Trump used this speech to describe his upcoming foreign trip, which his new national security adviser, Lt. Gen. H.R. McMaster, said would focus on a message of unity to the Muslim world. In his Coast Guard address, Mr. Trump invoked the phrase “radical Islamic terrorism” and said it was important to stamp it out. Ahead of a meeting with NATO partners in Brussels, he reiterated his call to make allies pay their share for defense.
The president’s comments at the ceremony were in contrast to more somber remarks from Adm. Paul F. Zukunft, the Coast Guard commandant, and John F. Kelly, the secretary of the Homeland Security, about the significance of leadership, character and the rule of law.
“With national security also comes public trust, and the two of those are interwoven,” said Admiral Zufunkt. “You don’t have both of those unless you have leaders of character.”
Mr. Kelly repeatedly referred to the United States as a nation of laws, and urged the graduates to focus on protecting the ideals of the United States constitution.
“Tell the truth to your seniors,” said Mr. Kelly, a retired four-star Marine general. “Even if it’s uncomfortable.”