By Mike McDonald

GUATEMALA CITY (Reuters) - The trial of former Guatemalan dictator Efrain Rios Montt on charges of genocide and crimes against humanity opened on Tuesday, the first time a country has prosecuted an ex-head of state in a national court on such charges.

For decades, Rios Montt avoided prosecution for atrocities committed during his 1982-1983 rule in a particularly bloody phase of the country's long civil war, protected as a congressman by a law that grants immunity to public officials.

Rios Montt, who left Congress in 2012, was ordered to stand trial in January when a judge found sufficient evidence linking him to the killing of more than 1,700 indigenous people in a counterinsurgency plan executed under his command.

"It's historic," Attorney General Claudia Paz y Paz told Reuters ahead of the trial. "We cannot leave thousands of deaths unpunished. We must deliver justice to the victims."

A court charged the former ruler in January 2012 for the war crimes, but his defense team had until now stalled the process with a series of appeals, arguing he did not control battlefield operations and that there was no genocide in Guatemala.

Prosecutors allege Rios Montt turned a blind eye as soldiers used rape, torture and arson against leftist insurgents and targeted indigenous people during a "scorched earth" military offensive that killed at least 1,771 members of the Ixil group.

Rios Montt had few words as he entered the courtroom.

"Whatever I say or don't say will be used against me," he told reporters. "I have to keep quiet. I am staying quiet."

Roughly 200,000 civilians, mostly of Mayan descent, were killed during the 1960-1996 conflict as a string of right-wing governments attempted to rid Guatemala of leftist guerilla fighters suspected of being in league with communists.

An additional 45,000 people went missing.

A United Nations-backed truth commission report released after the 1996 peace accords found that the army and paramilitary groups were responsible for more than 90 percent of the hundreds of massacres carried out during the war.

"This is the first time, anywhere in the world, that a former head of State is being put on trial for genocide by a national tribunal," United Nations High Commissioner for Human Rights Navi Pillay said in a statement.

"Until quite recently, no one believed a trial like this could possibly take place in Guatemala, and the fact that it is happening there ... should give encouragement to victims of human rights violations all over the world."

MILITARY COUP

Victims and human rights advocates applauded the start of the trial into Rios Montt's 17-month rule.

"Finally we're going to know the truth. It's justice for the survivors and for the world," said Sandra Moran, 53, who was laying flowers outside the court before the trial started. Her uncle was tortured during Rios Montt's government, she said.

Born in Huehuetenango, a province in Guatemala's rural western highlands dotted with indigenous communities, Rios Montt took power in March 1982 when he led a military coup that toppled President Angel Guevara.

He remained politically active after being overthrown in August 1983, serving in Guatemala's legislature and launching an unsuccessful bid for the presidency in 2003.

Genocide trials have been rare for ex-leaders in Latin America, a region scarred by bloody civil conflicts and fierce repression. Multiple charges were raised against former Chilean dictator Augusto Pinochet, but he died before standing trial.

Often sporting thick glasses and a gray mustache, Rios Montt has been under house arrest for more than a year. The right-wing party that he founded changed its name this year to distance itself from its past.

Rios Montt sat silently through pre-trial hearings, reading Guatemala's constitution and its penal code, occasionally nodding off.

Human rights groups filed a complaint against Rios Montt for genocide in 2001 and prosecutors will present hundreds of testimonies, videos and military documents in the trial against the former dictator, a process that could take months.

A three-judge panel must debate the material and set a date on whether to sentence or exonerate Rios Montt.

(Additional reporting by Stephanie Nebehay in Geneva; Editing by Dave Graham and Eric Beech)