National security adviser Michael Flynn attends a news conference at the White House on Monday. (Evan Vucci/Associated Press)

THE RESIGNATION of Michael Flynn as national security adviser offers President Trump an opportunity to right what has been a dysfunctional policymaking apparatus. Having previously been dismissed from a post at the Defense Intelligence Agency for erratic management, Mr. Flynn failed to prepare Mr. Trump for conversations with foreign leaders, inadequately vetted executive orders and staffed key positions with military cronies even before he lied to the media and vice president about the content of his conversations with the Russian ambassador. His self-destruction in a post that demands the steadiest of hands was widely anticipated; the only surprise was that it took just 24 days.

It’s not unusual for an incoming national security adviser to speak with foreign ambassadors, and it’s not entirely clear that what Mr. Flynn said to Russian envoy Sergey Kislyak in late December was improper. But Mr. Flynn clearly misled The Post, Vice President Pence and other senior officials when he said he did not discuss U.S. sanctions against Russia with Mr. Kislyak. He did so in the context of as-yet- unresolved questions about Russia’s interference in the presidential election and other possible contacts between the regime of Vladi­mir Putin and the Trump campaign. The affair underlines the urgency of an impartial investigation into those matters by the Justice Department, Congress or an independent commission and the full disclosure of the results to the public.

The White House’s handling of Mr. Flynn’s deception also raises concerns. According to The Post, the acting attorney general told the White House counsel late last month about Mr. Flynn’s false statements and warned they could expose him to Russian blackmail. White House press secretary Sean Spicer said Tuesday that Mr. Trump was informed “immediately” afterward, but the White House did not correct the false public statements about the Flynn-Kislyak call, and Mr. Trump told reporters last Friday that he was unaware of the issue. At a minimum, the episode further undermines the credibility of an administration that has repeatedly disseminated untruths.

Mr. Trump could begin to undo the damage by appointing a new national security adviser prepared for the job’s most essential work, which is serving as an honest broker in internal debates over questions of war, foreign policy and intelligence. The National Security Council chief should ensure that the unschooled Mr. Trump is fully briefed for encounters with foreign leaders and that policy steps — whether a response to a North Korean missile launch or a new strategy for fighting the Islamic State — are fully studied and discussed in an orderly way before a presidential decision is made.

The past two weeks have seen some welcome corrections by Mr. Trump to what looked like potentially rash departures from previous U.S. policies. He calmed Asian leaders by accepting the one-China principle and strongly backing the U.S. alliance with Japan, and he retreated from suggestions that the U.S. Embassy in Israel would be swiftly relocated to Jerusalem. His U.N. envoy affirmed that sanctions on Russia for its invasion of Crimea would remain in place.

(Adriana Usero/The Washington Post)

However, Mr. Trump still has some fixes to make — above all in U.S. relations with NATO allies, where signals from Cabinet secretaries and the White House have been conflicting, and in his dangerously appeasing stance toward Mr. Putin. A competent national security operation may not correct the president’s mistaken convictions, but it should, at least, provide him with better intelligence and options.