Retired Gen. David Petraeus told Congress on Wednesday that the US shouldn't take the existing international order for granted.

The former CIA director told the House Armed Services Committee that the post-World War II world order had begun to face an "unprecedented threat from multiple directions."

"Americans should not take the current international order for granted," Petraeus said. "It did not will itself into existence. We created it. Likewise, it is not naturally self-sustaining. We have sustained it. If we stop doing so, it will fray and, eventually, collapse."

The retired four-star general, who commanded forces in Iraq and later headed the CIA before resigning because of a scandal in which he was found to have shared classified information with his biographer and former mistress, was one of President Donald Trump's picks for secretary of state.

During his testimony to the House committee, he warned against isolationism and protectionism, which the new administration's policies support, instead advocating the kind of promotion of democracy around the world that the US has engaged in since World War II.

"To keep the peace, we led an effort to establish a system of global alliances and security commitments underwritten by US military power and the deployment of our forces to bases in Europe and Asia," Petraeus said.

"To create a foundation for prosperity, we put in place an open, free, and rules-based economic order intended to safeguard against the spiral of protectionism that produced the impoverishment and radicalization of the 1930s. And to protect freedom here at home, we adopted a foreign policy that sought to protect and, where possible, promote freedom abroad along with human rights and rule of law."

Petraeus called that system imperfect but largely successful. He named familiar adversaries like Russia, China, Iran, and Islamic extremists but said the most harmful threat was actually domestic.

"The world order has also been undermined by something perhaps even more pernicious — a loss of self-confidence, resolve, and strategic clarity on America's part about our vital interest in preserving and protecting the system we sacrificed so much to bring into being and have sacrificed so much to preserve," he said.

Petraeus also warned about how he believed the collapse of institutions like the NATO military alliance and the European Union could play into Russian President Vladimir Putin's hand.

"President Putin, for instance, understands that, while conventional aggression may occasionally enable Russia to grab a bit of land on its periphery, the real center of gravity is the political will of major democratic powers to defend Euro-Atlantic institutions like NATO and the EU," he said. "That is why Russia is tenaciously working to sow doubt about the legitimacy of these institutions and our entire democratic way of life."

Trump made waves in January by repeating his assertions that NATO was "obsolete" and remarking that the EU's future didn't matter much to the US.

View photos David Petraeus More

Petraeus also subtly rebuked the direction the Trump administration had taken on the fight against Islamic extremism, with which Petraeus has much experience.

Trump on Friday signed an executive order temporarily barring immigrants from seven majority-Muslim countries from entering the US. The order applies to citizens from Iran, Iraq, Libya, Somalia, Sudan, Syria, and Yemen, countries that the White House cited the Obama administration as having once flagged as "countries of particular concern."

Terrorism experts have argued that this will feed into the narratives of terrorist groups that claim the US is against Islam while doing little to prevent terrorist attacks inside the country.