Mock firing squads. Manacles. Blindfolds. This was not what I signed up for when I joined the Foreign Service in October 1978. But that was what I found when, assigned to Tehran as my first post, I was taken captive for 444 days by Islamic militants, along with 51 of my colleagues. I was 24 years old, and Iran was gripped by revolution.

In a performance memo for my personnel file, my boss, the director of the State Department’s Iran desk, later wrote that I had demonstrated qualities in captivity that would serve me well if I “decided to stay in the Foreign Service.” That line — if I “decided to stay” — was erased from the file. Doubt about future career plans wasn’t supposed to be part of one’s formal record.

I did stay in the Foreign Service, though, and retired last month as the last of the U.S. hostages on active duty with the State Department.

During my preparations for service in Tehran, I heard a description of the Iranian style of confrontation that turned out to be more fitting than I knew at the time. Iran scholar James A. Bill called it “the Peacock Show.” Two antagonists enter the field, dance and wave their feathers at each other. It becomes clear who has the more impressive feathers; the weaker one resigns the field without a fight.

The biggest Peacock Show of all, one that was inevitable after the success of the Islamic revolution, is the enduring confrontation between Iran and the United States. Both sides want to be stronger in the region — or at least want to appear so. That’s what we see with economic sanctions, our naval presence in the Persian Gulf,Iran’s nuclear ambitions and the recent push to grant U.N. inspectors access to the country’s alleged nuclear research sites. We are in the ring, feathers waving, with our friends and adversaries nervously watching this show of force.

I started Farsi language training in January 1979 and closely followed the conflict between the Western-backed shah,Mohammad Reza Pahlavi,and Ayatollah Ruhollah Khomeini. After the shah fell, the conflict in the Islamic republic was between Western-educated secularists, who controlled the trappings of government power, and Islamic fundamentalists, who controlled the mosques and the local militia komitehs.

I arrived in Tehran in July and was soon fully occupied in the operations of the consular section, where I was the most junior officer. The consulate had been closed for most visas since the U.S. Embassy was taken and held for 24 hours in February, but as rumors of our scheduled reopening that fall hit the news media, a line started to form outside.

By the time we opened, that line resembled a long, narrow picnic, with applicants sitting on rugs, queued up for 10 blocks. The waiting list eventually grew to 35,000, according to Iranian police reports, and we were interviewing about 300 people a day. It was draining work. Most applicants were obviously not tourists, and many were afraid for their lives and just wanted to flee. So in addition to the stress of constant anti-American demonstrations, our days were filled with life-or-death decisions about visas — one every 10 or 15 minutes.

After the shah was allowed into the United States for medical treatment on Oct. 22, we witnessed demonstrations against the embassy demanding his return. Two blocks from the embassy was a soccer stadium, which was later proposed as the helipad for a rescue attempt. On several occasions we watched from the roof of our apartment building as soccer fans took advantage of the size of the crowds and their proximity to the embassy to stage demonstrations. It was sometimes hard to take them seriously.

On Nov. 4, it was clear that something changed. Our Iranian National Police guards had taken off. For the first time, some demonstrators crossed the wall of the embassy compound and directly confronted the Marines providing security.

When it became evident that the embassy was not going to hold out and the Iranian government was not coming to our rescue, we were instructed to break up into small groups and try to escape out the back door. All of our local employees, our customers and five of our American employees made it out. I was in the last group. We had made it two blocks when a uniformed Revolutionary Guard turned us around, firing a very loud shot over our heads with his assault rifle. So much for a demonstration from an “independent” group of students.

The standoff between the United States and Iran that those demonstrators launched was destined to be a long one because of the interplay of two inconsistent philosophies. The Iranians were in the arena flashing their feathers, making a determined, ostentatious show of strength. The Americans were looking for a face-saving compromise but didn’t want to appear to give in. The Iranians would ratchet up the pressure, for example, by threatening to try the hostages as spies. The Americans would threaten retaliation, being careful not to go too far.

I sometimes describe my confinement as 95 percent utter boredom punctuated by 5 percent excitement. On April 25, 1980, it got exciting. Our guards came in, quite agitated, and told us we would be moving. After one interim move, I found myself in the guest house of an Iranian military base on the Caspian coast with Marine Kevin Hermening. Kevin and I spent a lot of time speculating about the reason for the move — especially since it eliminated any pretense that the Iranian government was not supporting the hostage-taking.

Months later, I got the answer in a letter from an American elementary school student. In the midst of a description of the charming routine of her school day, she wrote, “We’re sorry the rescue attempt failed.” Really? Wow. So was I. My only hint of the rescue attempt was in these letters from schoolchildren, part of our very limited contact with the outside world. Even this show of force by the United States, viewed in the context of the Peacock Show, was seen as a sign of weakness by the Iranians.

From Day One, our captors didn’t give us any information that reflected on the prospects for our freedom. But the Iranians couldn’t keep all information from us. I was reading an article in the Sporting News, one source of entertainment we were allowed, and discovered in late August 1980 that the shah was dead. The information was tucked into a story about the sensitivity of preempting games on U.S. television. Once, a network cut off a football game for a scheduled showing of the movie “Heidi.” The current example was breaking into a baseball game the month before for a special report on the death of the shah.

Imagine our disappointment. The militants’ main demand was that the United States extradite the shah. If he was dead, why would they continue to hold us?

The militants refused to acknowledge his death. It became kind of a morbid joke for me. I would ask a guard, “Has the shah come back yet?” The guard would give me a puzzled look, and I would repeat the question: “Has the shah come back yet?” I would explain: “You’ve told us that we would be free when the shah came back. I was just wondering whether he had arrived yet.” I would get a smile from the guard and the answer, “No, Mr. Cooke, the shah has not come back yet.”

When we were told the results of the 1980 election, I said to myself, “It’s time to pack my bags.” Some of my colleagues favored the Carter administration’s patient negotiating style. But even they thought that the animosity between the administration and Iran was becoming an insurmountable obstacle to our freedom. To drive home that point, the Iranians delayed our release until after Ronald Reagan was inaugurated.

Two years later, from the comfort of my apartment in Paris, I watched an interview with former Iranian president Abol Hassan Bani-Sadr, then in exile, also in Paris. He recounted how he had learned of the decision to release the hostages. He went to Khomeini to object, saying that nothing had changed, that Iran still had the advantage. Bani-Sadr reported that the ayatollah waved his hand and said, “It’s over, it’s over.” The ayatollah has been described in many, often unflattering, ways, but he knew that the Reagan administration was committed to end the hostage crisis by any means necessary. Khomeini was clearly a man who could count feathers.

The hostage crisis concluded more than 30 years ago, but the confrontations with the Islamic republic continue. Over the decades, we’ve seen the Iranians attack tankers in the Persian Gulf, provide weapons and training to Hamas and Hezbollah, and, through their proxies, attack our troops in Iraq. In each case, the success of our response depended both on appearing resolute and on being resolute.

When I worked as a Provincial Reconstruction Team leader in Iraq’s Karbala province, we tracked and countered Iranian influence in the Iraqi Shiite heartland. Now, world shipping faces Iranian threats in the Straits of Hormuz. Iran remains a key state sponsor of terrorism. And it is pursuing the biggest feather of them all — nuclear weapons.

All of this is playing out, as it did in 1980, in the worst possible time in the American political cycle, an election year. The penalty of the election year delay in 1980 was that my beard got longer and I lost more weight. Today, the penalty of an election year delay is that Iran’s centrifuges keep spinning, enriching uranium, getting Iran closer to the ability to build a nuclear weapon.

Iran is coming back to the negotiating table — but not because it has suddenly decided to live up to its international obligations. These talks may provide a face-saving way to halt its nuclear program. The key to the Iranians accepting such a solution is to convince them that we have the capability and the will to end their program ourselves. The irony is that the more clearly we demonstrate that capability and will, the less likely we will need to use them.

Don Cooke retired from the State Department as a senior policy adviser for Iran after a 33-year career in the Foreign Service. He currently consults on economics and the Middle East.

Read more from Outlook, friend us on Facebook, and follow us on Twitter.