Story highlights The Arizona Republican has recently criticized policies backed by Trump

He warned about the dangers nationalism and isolationism pose to democracy

Washington (CNN) Sen. John McCain warned of the dangers that he said nationalist and isolationist ideas pose to democracy in a speech at the US Naval Academy Monday night, his latest veiled swipe at the policies of President Donald Trump, though he didn't mention the President by name.

The Arizona Republican -- who has recently criticized policies backed by Trump -- told midshipmen that democracies need to recognize the risks these groups pose, saying "it's time to wake up."

he "(W)e are asleep to the necessity of our leadership, and to the opportunities and real dangers of this world,"he said . "We are asleep in our echo chambers, where our views are always affirmed and information that contradicts them is always fake. We are asleep in our polarized politics, which exaggerates our differences, looks for scapegoats instead of answers."

McCain said World War II-era American statesmen knew "that tyranny is always a threat to peace" and that "there could be no more isolationism, no more tired resignation -- no more 'America First'" -- a phrase often touted by Trump.

McCain also alluded to the US-Mexico border wall proposed by Trump.