WASHINGTON — Senator John McCain has long had a reputation as a political maverick. But with the rise of a president who has vowed to shatter the old order, Mr. McCain has emerged as an outspoken defender of longstanding Republican verities on foreign policy and as one of his party’s most biting critics of the new commander in chief.

Newly re-elected to a six-year term and eager to wield the megaphone that comes with the chairmanship of the powerful Armed Services Committee, Mr. McCain has repeatedly pushed back on the White House’s national security policies in its first weeks.

In a star turn at a security conference in Munich on Friday, he delivered a forceful critique of President Trump’s “America First” vision before a receptive audience of experts and allied officials worried about American drift from a seven-decade-old Western alliance.

“Make no mistake, my friends, these are dangerous times,” Mr. McCain said. “But you should not count America out, and we should not count each other out.”