The federal government's recent partial shutdown, which set a record for the longest in U.S. history, ended after 35 days. Regrettably, there was no permanent solution, as the agreed-on funding was only for three additional weeks. If no permanent agreement is reached by then, the standoff will once again resume, a continuing black eye for America with numerous disastrous consequences, some known and many still unknown.

The efforts to reach an accommodation between an unpredictable president and a highly determined speaker of the House, was a classic example of how not to reach an agreement: name-calling, public posturing and high-profile meetings without ground rules.

If they really want to break up this logjam, it's time for the president and congressional leaders to try a new approach, one in which a mediated solution is explored. There is virtually nothing to lose by this approach and everything to gain.

What's needed for the mediated approach?

First, the president and congressional leaders should call on a credible third party to serve as an intermediary and provide critical assistance in the discussions and negotiations. An intermediary is essential. Finding the right mediator is a difficult assignment, but it can be done. Candidates could be retired legislators, jurists or even presidents. To avoid any hint of partisanship, a co-mediation can be attempted by a Republican and a Democrat. Nor does the mediator have to be a former government leader. Just one possibility is Kenneth Feinberg, who has successfully mediated major matters ranging from the World Trade Center claims to oil spills and college shootings.

Using a mediator would not in any way be a sign of weakness for the disputants. On the contrary, it would demonstrate an unwavering commitment to reaching a solution.

Second, the parties must identify and work toward their real interests instead of their publicly stated positions. We all know that so far the president and the speaker are inflexible on the question of funding or not funding a physical wall, at a stated price of nearly $6 billion. But the professed interests of the disputants are (or at least they state they are) achieving better border security and adopting a rational and workable immigration policy—common goals.

Third, all the critical decision makers must participate in the conversation. So far, it has been President Trump and Speaker of the House Pelosi, with the vice president, Senate Minority Leader Chuck Schumer and a few others looking on. If a legislative solution is to be reached, all critical legislative stakeholders must participate in the discussion with the president.

The mediator can assist in many ways.

• Initially, and most importantly, in helping the parties to acknowledge their true interests outlined above.

• Developing options. During the course of the debate, as inflammatory as it has been, a number of midway positions have been advanced. Some of these include achieving interests supported by both parties using technology rather than physical barriers and employing a much more scaled-down and less costly physical barrier.

• With respect to option building, the mediator can take the pressure off the parties by suggesting a number of other possible solutions rather than have them come from the parties themselves. Professional mediators often refer to “reactive devaluation.” Greatly oversimplified this means that if an idea is advanced by one side, the other will have a tendency to want to reject it: “If you propose it, then I automatically don't like it.” A proposal coming from the mediator, after input from both sides, is much less likely to be rejected in knee-jerk fashion.

• Toning down the rhetoric. It's hard to agree with someone who keeps insulting you. While a mediator may not be able to keep tweets from flying during a mediation, a modicum of civility can certainly be introduced to the conversation. Sitting between Trump and Pelosi could be hazardous, but a skilled and experienced mediator can keep discussions productive, even in the midst of strong egos, volatile personalities and erratic behavior.

• Reality testing. The mediator, in both joint and private meetings with the parties, can explore the efficacy of what the parties propose to do: “Will that really achieve what you are seeking?” The mediator can channel parties away from courses of action which are likely to continue the dispute and introduce even more uncertainty, and probably litigation, such as seeking out a unilateral solution through an executive order or declaring an emergency.

• Another benefit to using a mediator would be to resolve the matter without either party appearing to be a loser or having caved in. The mediator can guide the parties toward a resolution without either side losing face. While it may seem unlikely at this point, if a mediation is done well, both sides can emerge looking like statesmen.

In resolving a high-stakes situation such as the government shutdown and fixation on a single wall or no wall issue, parties can lose sight of the fact that the process used in seeking a resolution is extremely important and can often determine whether impasse can be broken. Clearly, the current process of meeting before television cameras, lobbing insults and rejecting the same proposal over and over again has not been productive, but instead dysfunctional.

It is way past time to try a mediated approach with a credible trusted third party exploring new options, accommodating the true interests of the parties and the country.

Harry N. Mazadoorian is a commercial arbitrator, mediator and member of the American Arbitration Association's Master Mediator Panel. He is the distinguished senior fellow in the Center for Dispute Resolution at Quinnipiac University School of Law.