Correspondent Elizabeth Becker (right) in Cambodia in 1974 with the Cambodian Prime Minister Long Boret, center. ( Courtesy of Elizabeth Becker )

Elizabeth Becker is an award-winning journalist and author. Her recent book is “Overbooked: The Exploding Business of Travel and Tourism.”

The sound of gunshots jolted me awake, echoing off the walls of my bedroom like cymbals. What was going on? I slipped on my jeans and crept into the foyer of our guesthouse.

My attacker was waiting there, bandoliers of ammunition strapped across his chest. He pointed a pistol at me.

“Don’t shoot,” I screamed, as I ran into my bathroom and dove into the tub. He didn’t follow me, instead charging upstairs. I sat paralyzed in the dark for the next three hours, listening as the gunman fired a dozen bullets on the floor above me, then fled.

It was 1978, and I was one of three Westerners invited inside Cambodia under the murderous Khmer Rouge. Carrying one of the only two journalist visas ever issued by the regime, I spent two weeks under heavy surveillance, investigating the stories I’d heard from refugees about vast labor camps, torture chambers and summary executions.

We were assaulted just hours before we were scheduled to leave. When a Cambodian official finally rescued me, I learned that my colleague, the academic Malcolm Caldwell, had been killed, shot several times at point-blank range. (Richard Dudman, a journalist with the St. Louis Post-Dispatch, survived.) Though I can’t prove it, I believe that someone in the government had opposed our trip and wanted to silence us.

Thirty years later, I was summoned back to Phnom Penh. Cambodia was finally prosecuting the Khmer Rouge officials responsible for the country’s genocide. In just four years, they had killed 2 million people, a fourth of the population. The prosecution wanted me as a witness.

I understood why. I was the only Western journalist to witness both the devastating Cambodian civil war and the Khmer Rouge regime that followed. I had exclusive interviews with top officials, who’d confessed to the use of torture chambers and forced labor under hideous conditions. I had researched dozens of Cambodians who’d been arrested, tortured and killed. And I had seen the once-vibrant capital emptied.

But this was new territory for a dispassionate reporter. Should I testify in a legal case to help prosecutors? War correspondents are divided about whether to do this; they don’t want to turn their colleagues into targets. If dictators and war criminals knew that reporters might testify against them in court, would it make attacks like the one I experienced more common?

I arrived in Phnom Penh at the end of 1972, straight from graduate school in South Asian politics. Within five months, I was The Washington Post’s special correspondent.

At the time, Cambodia was in the middle of a brutal civil war, triggered by the neighboring struggle in Vietnam. The United States was underwriting the corrupt government; communist Vietnam was supporting the Khmer Rouge.

For two years, I reported on a country being rapidly disfigured by warfare and a massive American bombing campaign. I watched as the once-elegant capital came apart, with barbed wire snaking in front of cafes and neighborhoods overcrowded with families fleeing the countryside.

I returned to Washington at the end of 1974, hoping to put the war behind me. But I couldn’t. Even after the conflict ended the next April, I heard disturbing stories from refugees — of the forced evacuation of Phnom Penh by Khmer officials; of executions of former officials, soldiers, teachers and the educated. But there was no way to reach my Cambodian friends to find out what was happening: The Khmer Rouge had cut off all telephone, telegraph and mail service.

I wanted to go back and see for myself. So for four years, I went up to the United Nations every October to interview Ieng Sary, Cambodia’s foreign minister, and ask him for a journalism visa. Every year, he refused. The Khmer Rouge allowed only communists or sympathizers across its borders. Finally — eager, I think, for coverage that might encourage the West to intervene against Vietnam, which was threatening invasion — he relented. In December 1978, I returned.

During our two weeks in Cambodia, we were escorted everywhere by guards and minders. Our interviews were all prearranged by the government. The soldiers, officials and farmers we met were carefully screened. Just in case, senior officials translated and monitored our conversations.

Although the most extreme horrors were hidden from view, I saw enough to know that something profoundly evil had happened. Phnom Penh, the city the Khmer Rouge had emptied in the name of the revolution, was devoid of the lively Cambodian society I had known. Shuttered pagodas. Dismantled churches. Empty mosques. Abandoned schools. Closed stores. Vacant restaurants. I kept thinking I’d turn a corner and see real life — children playing a game, women bargaining at the Central Market, something. But there were no people, nothing.

On our final day, we interviewed Pol Pot. It was surreal. The dictator ignored our written questions, instead lecturing us about the coming war with Vietnam. The next month, the Khmer Rouge was overthrown by the Vietnamese.

In the six years that followed, I returned to Cambodia to piece together the story of the Khmer Rouge: how talented intellectuals became communists, fought against French colonial rule and then challenged the Cambodian government. How in victory they undertook one of the most radical (and incompetent) communist revolutions in history, turning Cambodia into a rural authoritarian hell. My book “When the War Was Over” told this story.

Despite the horrors I saw, I wasn’t quite sure what to do when I received an e-mail from the prosecution in 2009, telling me that I’d be summoned to testify. A handful of journalists have been asked to appear at tribunals covering countries like the Balkan nations and Rwanda. But it’s a difficult proposition. Many American news organizations believe that by testifying in war-crimes tribunals, reporters jeopardize their neutrality and the safety of correspondents, especially as war reporting has become more dangerous.

It’s not an unreasonable fear. Since 1992, at least 228 journalists have been killed while covering conflicts and 145 more have died on other dangerous assignments, according to the Committee to Protect Journalists. At the brutal extreme, the Islamic State captures and kills journalists as a war strategy; it beheaded James Foley and Kenji Goto on video.

For that reason, Jonathan Randal, a former Post correspondent who covered the Balkan wars, refused to answer a subpoena in 2002 to appear before the International Tribunal for the Former Yugoslavia. Backed by this newspaper, he appealed the subpoena and won, establishing a limited legal protection for war correspondents against forced testimony that could turn a reporter into a target during war. “If it had gone the wrong way,” he told me, “it would have made correspondents more vulnerable.”

The Committee to Protect Journalists supported Randal’s efforts. “Journalists are able to function [in war zones] because they’re viewed by all participants [of a conflict] as a useful conduit who can communicate with the world,” explained Executive Director Joel Simon. If they are compelled to speak at trials, it’s “a risk to the journalist and to the flow of information.”

With this in mind, I consulted a lawyer. If I volunteered to testify, he told me, I would not be going against that precedent. Plus, I was appearing as an author and a foreign correspondent, not just a war reporter. My basic legal responsibility, he said, was to respect the First Amendment and protect any confidential sources, which I’d done.

Reassured that I met my legal obligations, I consulted with Cambodian friends such as the banker Mey Komphot, who survived the Khmer Rouge rule but never fully recovered his spirit. He and many others urged me to testify. I thought, too, about people like Hout Bophana, 25, a beautiful young woman from northwest Cambodia who had been separated from her husband, her childhood sweetheart. When the Khmer caught her sending forbidden love letters, she was tortured for months with whips, chained to an iron bed, raped and finally executed.

With Bophana on my mind, I agreed to testify. I had been privileged, as a journalist, to collect materials and experiences that no one else had. With that came responsibility. I also wanted to honor the systems of law that are slowly bringing justice to countries like Cambodia.

I assumed I’d be on the witness stand in a matter of weeks. But for four years, each time I was summoned by the prosecution, a defendant would say he was too ill to exercise his right to defend himself. My appearance would be postponed.

I finally took the stand last month against the regime’s two most senior survivors: Pol Pot’s deputy, Nuon Chea, and Khieu Samphan, the former head of state. They are charged with genocide and crimes against humanity, and face life in prison.

Court decorum was formal. The judges wore red robes; prosecutors were in purple. In the gallery, audience members listened to the proceedings through headphones that translated into Khmer, English or French. My witness chair faced away from the public, in a courtroom surrounded by bulletproof glass.

For three days, lawyers took turns questioning me about my reporting and my book, reading me long passages to confirm that I had done an interview, uncovered a document or seen firsthand how Cambodians lived under the Khmer Rouge. My voice cracked when I described Caldwell’s murder. Eventually I began to feel comfortable, even when Nuon Chea rose from his sickbed and came to court to interrogate me directly about American policy during the war.

Each day, seven people brutalized by the regime were given seats in the courtroom. Whenever I felt overwhelmed, I was reassured looking at their faces, knowing they had petitioned the court to bring justice.

Two nights before my testimony, I met Rithy Panh for drinks. The Cambodian filmmaker and I have been friends since he made a movie based on my story about Bophana nearly 20 years ago. (A year ago he was nominated for an Oscar for his movie “The Missing Picture,” about his own life and wrenching losses under the Khmer Rouge.) I told him I was uneasy about my court appearance and asked for his advice.

He was brief.

“You’re doing this for Cambodia,” he said. “That’s all. You’re doing this for us.”

Read more from Outlook and follow our updates on Facebook and Twitter.