President Donald Trump initially avoided his administration's scandals at a commencement ceremony Wednesday. But it didn't last long.

Trump pumped up Coast Guard Academy graduates by outlining the "path of service" they chose and their role in bringing "law and order" to the waters around the United States.

Their commander in chief then aimed to teach the graduates lessons about perseverance — through the lens of White House media coverage.

"Look at the way I've been treated lately, especially by the media. No politician in history — and I say this with great surety — has been treated worse or more unfairly," he said in his commencement address in New London, Connecticut.

"You can't let them get you down," Trump said, adding, "I guess that's why we won" the presidential election.

Trump made the comments as his White House struggles with the backlash to his firing of James Comey, who led the FBI as it investigated possible links between Trump campaign associates and the Kremlin. The president faces questions about whether he tried to impede the bureau's investigation.

On Tuesday, reports confirmed by NBC News indicated that a memo Comey wrote in February shows that the president asked him to shut down the FBI investigation into ex-national security advisor Michael Flynn. Key congressional committees are now requesting FBI records on communication between the president and Comey.

Last week, Trump directly contradicted his own spokespeople after they said his decision to fire Comey was prompted by criticism of the FBI director from within the Justice Department. He told NBC News that he would have fired Comey "regardless" of what the Justice Department said.

The president added that he was considering "this Russia thing" when he ousted the FBI director.

In the address Wednesday, Trump defended his first months in office and outlined what he deemed his accomplishments. He cited the confirmation of Supreme Court Justice Neil Gorsuch and a boost to military spending in the funding bill he recently signed into law, among other topics.