Sergei Karpukhin/Reuters
Kagan warned in his prepared testimony that "the era of great-power rivalries has returned."
"Only these two great powers [Russia and China] have the capacity to upend the world order which has long provided for Americans' security and well-being," Kagan told the Senate Armed Services Committee.
"The unmistakable hegemonic ambitions of China and Russia threaten the stability and security of the world's two most important regions, East Asia and Europe. These regions are vital to the United States both economically and strategically."
He warned against isolationist foreign policy, which President-elect Donald Trump seemed to champion during the campaign season. Kagan has been an outspoken critic of Trump - he wrote a column for The Washington Post in May about how Trump could bring fascism to America.
"These past 25-30 years have ... provided us a clear formula for success, a formula inherited from those early years after World War II," Kagan said.
"By building and maintaining strong alliances with democratic nations and by supporting an open global economy that allows those nations to prosper, and which lifts billions of others in developing nations out of poverty, the United States can best protect its own security and the well-being of its own people."
Trump said during the campaign that he thinks the NATO alliance is obsolete and suggested that if allies didn't contribute more to their own
"The perceived weakness and withdrawal of the United States as a result of the present administration's policies and rhetoric has unfortunately been greatly exacerbated by the comments of the president-elect and his proxies during this year's campaign," Kagan said.
"Suggestions that the United States might not come to the defense of NATO allies if attacked by Russia ... that it is a 'real problem' that the United States has to come to Japan's defense if it is attacked, and in general that the United States should fulfill its security commitments to other nations only if it makes economic sense - all these have only increased doubts about America's reliability as an ally and partner. They have given the clear impression to both friends and potential adversaries that the United States is turning inward, abjuring responsibility for global security, and effectively ceding hegemonic dominance of Europe and East Asia to Russia and China."
Kagan stressed the importance of alliances.
"Those bonds, together with a strong US military and strong US economy, prevailed in the Cold War, convinced Soviet leaders to concede peacefully, and established this extraordinary period in the history of international relations," Kagan said. "It has not been perfect, because perfection in human affairs is not possible. But by any reasonable standard, this formula has been successful - and successful for the American people."
He also warned the Senate committee about what could happen if the US were to weaken its ties to its allies.
"In the past these great-power competitions have led invariably to great-power wars," Kagan said. "Managing these rivalries, avoiding war, and doing so without abandoning the liberal world order in the misguided belief that we will be spared when it collapses, is the greatest challenge we face today and in the years and decades to come."
Kagan's testimony comes at a time when populist movements are rising across Europe and anxiety about globalization and immigration is rising.
At the same time, Russia and China appear to be getting more aggressive on the world stage.
"Both seek to redress what they regard as an unfair distribution of power, influence, and honor in the American-led postwar global order," Kagan testified.
"Being autocracies, both feel threatened by the dominant democratic powers in the international system and by the democracies on their borders. Both regard the United States as the principal obstacle to their ambitions, and therefore both seek to weaken the American-led international security order which stands in the way of their achieving what they regard as their rightful destinies."
A weakened NATO could be especially dangerous when it comes to Russia, which has been expanding its influence in former Soviet countries. Kagan noted that Russia "has invaded two neighboring states - Georgia in 2008 and Ukraine in 2014 - and in both cases has hived off significant portions of those two nations' sovereign territory."
China, on the other hand, "has until now been the more careful and cautious, seeking influence primarily through its great economic clout in the region and globally, and using its growing military power chiefly as a source of deterrence and intimidation," Kagan said. But its military expansion in the South China Sea indicates that "China's willingness to use force cannot be ruled out in the future."