This summer’s major constitutional news was the Supreme Court’s ruling in favor of President Obama’s health care law. Millions of Americans disagreed with the decision, but all agreed that the decision was final—the Supreme Court is the ultimate arbiter of constitutionality.

But for six million people in a tiny nation in Central America, this summer featured a full-blown constitutional crisis. Twenty years after the signing of the post-civil war peace accords, El Salvador faced one of the most challenging moments in the development of its democracy. Shaking the foundations of its democratic institutions and questioning the basics of the rule of law, El Salvador’s government and political leaders tested the limits of their constitution and settled (hopefully once and for all) who has the last word when it comes to matters of constitutionality.

Supreme Court justices in El Salvador are elected by the National Assembly every three years, typically at the beginning of each legislative session. In April, the 2009-2012 National Assembly elected new justices in the final month of its session—in addition to those justices it elected in 2009 at the beginning of the session. Many Salvadorans believed this move violated the spirit of the law, since the custom was that each Congress elected one set of justices. But this wasn’t the first time an Assembly had done this: the 2003-2006 Assembly also elected two sets of justices, at the beginning and end of its session.

In June, the Constitutional Chamber of the Supreme Court ruled the elections of the 2006 and 2012 justices to be unconstitutional. Stating that the constitution allows each Assembly to elect only one set of justices, the ruling required that a full two-thirds of the Supreme Court be re-elected.

The decision angered the political parties who supported the election of the 2012 justices, and the National Assembly voted to appeal the high court’s ruling to the Central American Court of Justice. But the jurisdiction of this “higher court” (based in Nicaragua) to decide what is constitutional in El Salvador is debatable at best; many would claim there are serious sovereignty issues.

What followed was nothing short of political high drama. The Central American Court of Justice issued a preliminary ruling siding with the Assembly over the Salvadoran Supreme Court. When the new class of justices elected by the Assembly appeared for their first day, they found the offices locked—and called a locksmith to gain entry to the chambers.

Shortly before arriving at the LBJ School, I was invited to join a delegation of young American political leaders traveling to El Salvador. The trip was sponsored by the aptly-named American Council of Young Political Leaders, which receives funding from the U.S. State Department for cultural and educational exchanges. Our visit could not have come at a more fascinating time. The night before we left Washington in July, we had dinner with El Salvador’s ambassador to the United States. The next morning before our flight, the delegation met with regional desk officers at the Department of State. But nothing could have prepared us for the week of meetings with government officials, political party leaders, members of the National Assembly, and Supreme Court justices that would follow.

Coming to El Salvador with a strictly constitutional approach to the situation, I was amazed by the political dynamics at play—too numerous and complicated to describe here. We met with Supreme Court justices from the 2006, 2009, and 2012 classes, listening to their perspectives on the crisis and proposed solutions. We met with the president of the National Assembly and leaders from across the spectrum of political parties, many of whom were participating in the negotiations convened by the President while we were in San Salvador.

We also met with the U.S. ambassador to El Salvador, who was recently confirmed by the Senate and arrived in-country amidst this crisis. While we were in El Salvador, prominent U.S. senators called for the suspension of foreign aid to the country unless it could restore democratic order. The Salvadoran reaction to these statements cannot be overstated, and it was clear that the United States had a major role to play in encouraging all sides to find a constitutional resolution to the crisis.

In August, the president of El Salvador announced an agreement to bring a negotiated resolution to the issue. The leaders of all political parties agreed to re-elect the 2006 and 2012 justices and to elect a new Supreme Court president.

Thus the crisis ended, with El Salvador taking a major step forward in strengthening its democracy. The lessons the country will learn from this crisis remain to be seen, but hopefully the precedent is set that the decisions of the Supreme Court’s Constitutional Chamber on matters of constitutionality are final. Agree or disagree, a commitment to the principles of separation of powers and checks and balances requires that no one can reject the ruling of the highest court—or appeal the decision to a “higher” international court.

There are lessons for the United States, too. Pressure from our political leaders, including calls to withhold aid through the Partnership for Growth and suspend consideration of a second Millennium Challenge Corporation compact for El Salvador, was significant in convening all parties for serious negotiations. America has many tools of influence, and its willingness to use them can help countries strengthen their institutions, promote rule of law, and re-commit to the democratic order.