Julian Zelizer is a professor of history and public affairs at Princeton University, and author, with Kevin Kruse, of the forthcoming "Fault Lines: A History of the United States Since 1974." The opinions expressed in this commentary are his own. View more opinion at CNN.

(CNN) Secretary of Defense James Mattis is stepping down at an extraordinarily fraught moment in American foreign policy. Coming in the wake of President Trump's surprise decision to withdraw troops from Syria, without having consulted allies and after barely talking to his own national security advisers, Secretary Mattis becomes the latest "adult in the room" to leave.

Julian Zelizer

The resignation takes place at a moment of great risk for the United States and its allies. The President is heading into a tumultuous period at home, which can trigger him to make even more impulsive decisions abroad. Democrats are about to take over the House, the President is facing multiple investigations -- all of which are producing some very serious accusations -- and his national approval ratings remain low. Even though Republicans are still standing by their man, the President is being boxed into a corner. That's when he can be most dangerous.

The big risk is that the President unleashes on his opponents by moving forward on some of the most radical ideas that have floated in his head, or that he proves that he is in charge by taking big, dramatic actions. That he might just allow the shutdown of the federal government, or make foreign policy based on whims and emotion rather than strategic planning. Perhaps, some fear, he will unleash military force to demonstrate that he is the commander in chief.

Read More