Thousands of Sandinista militants on Tuesday bid goodbye to Tomas Borge Martinez, the last surviving founder of the guerrilla movement that overthrew Nicaragua's U.S.-backed right-wing dictatorship in 1979 and replaced it with a leftist government also criticized for repression.

Mourners wearing hats and T-shirts with Sandinista logos waited in snaking lines up marble stairs to the second floor of the National Palace of Culture where Borge's casket was surrounded with dozens of floral arrangement while revolutionary music blared in the plaza outside.

Most of the mourners came with their neighborhood organizations or unions.

"We wouldn't have had a revolution without him," said Glenda Perez, a social science university professor and Sandinista militant.

President Daniel Ortega announced three days of national mourning on state television for his longtime ally Borge, who died Monday night at age 81 after being hospitalized last month for pneumonia and other ailments. Borge joined with Carlos Fonseca Amador and others in 1961 to found the Sandinista National Liberation Front. It was named for Augusto Cesar Sandino, who fought against U.S. military intervention in Nicaragua in the 1930s. Ortega joined the front later and became its leader.

"Like Carlos Fonseca, he (Borge) is one of the dead who never die," first lady Rosario Murillo said in an emotional announcement, her voice appearing to break at times. "He will always be with us in the Sandinista Front."

Borge's body, dressed in a faded olive drab military jacket, lay in state in an open casket at the National Palace of Culture. Ambassadors and government ministers filed by, some tearfully. A few mourners bowed or saluted in front of Borge's body.

An incendiary speaker, combative personality and avid admirer of the communist governments in Cuba and North Korea, Borge was central to both the overthrow of Anastasio Somoza Debayle and the establishment of a junta after the revolution and then the elected Sandinista government. He became the target of the Contra rebels supported by the Reagan administration.

Jailed twice by the Somozas' brutal dynastic dictatorship, Borge was himself accused of human rights violations as the powerful interior minister during the 1985-90 elected Sandinista administration, until it was voted out of power.

Working from a six-story building that bore the slogan "Guardian of the People's Happiness," he controlled the police, immigration agents, jails and even firefighters, often using his nearly unbounded powers to punish the Sandinistas' enemies in the press, Roman Catholic Church and private business.

Miskito Indians living along Nicaragua's Caribbean coast alleged Borge orchestrated the displacement and killing of Miskitos suspected of anti-Sandinista activities, said Marcos Carmona, president of Nicaragua's Standing Commission on Human Rights. Borge was also accused of ordering the killing of 37 opposition members in a jail in the city of Granada during President Daniel Ortega's first term in office, something Borge always denied.

A staunch defender of the Sandinistas and Ortega, who won back the presidency in 2007 and was re-elected last year, Borge once wrote that "the return of the right is inconceivable" and pledged before the 2011 presidential election that the Sandinistas would stay in power "forever." Asked that year who he most admired, he responded: "First, Fidel Castro. Second, Fidel Castro. Third, Fidel Castro. Fourth, Fidel Castro. Fifth, Fidel Castro."

Congressman Jacinto Suarez called Borge "a transcendental figure in Nicaraguan history, not just for his founding of the Sandinista National Liberation Front, but for his fight to free the Nicaraguan people from Somoza's dictatorship ... I knew him for 40 years and we always had a friendly relationship, but due to his strong character it was impossible not to have some kind of rift with him."

Renowned Nicaraguan writer Gioconda Belli, a Sandinista who later broke with the movement, found a tragic trajectory in Borge's life.

"For a good portion of the Nicaraguan revolution, Tomas Borge sought to embody its free-flowing, original character," Belli said. "Grandiose and unpredictable, he could be tough with one hand and extremely generous with the other. He was a good friend of his friends. After 1990, I have the sense he gave up his revolutionary illusions ... He ended up a tragic-comic figure."

Still, Belli said, Borge's death "has made me very sad. I feel as if an era of Sandinismo died with him, notwithstanding the fact that he did not end his life as valiantly as he once lived it."

Born on Aug. 13, 1930, to a poor family in the city of Matagalpa, north of the capital, Borge left university before graduating and dedicated himself to the struggle against the hated Somoza family, which ran Nicaragua almost as an extended plantation from 1937 until it was toppled by the Sandinistas in July 1979.

Economists estimate the Somozas owned about 20 percent of the country's cultivable land, as well as sugar mills, banks, credit companies, cattle ranches, fishing fleets, construction companies, florists and other businesses.

Borge received military training in Cuba, and in 1956 he was arrested and jailed for three years on charges of involvement in a plot that ended with dictator Anastasio Somoza Garcia's assassination by the poet Rigoberto Lopez Perez. Borge escaped from jail and took refuge in Honduras, El Salvador and Costa Rica.

After returning to Nicaragua, Borge helped found the Sandinista movement, which began small-scale armed actions against the dictatorship about a decade after its founding.

Imprisoned for subversive activities at the time of Chamorro's killing, Borge was liberated in August 1978 after a Sandinista commando force attacked the National Palace, took legislators hostage and traded them for a group of Sandinista guerrillas who then escaped to Cuba.

Borge became minister of the interior after the Sandinista victory in July 1979 that toppled Somoza Debayle, who was the son of the slain Somoza Garcia.

As interior minister, Borge was accused of expelling and harassing clergymen during the war against the Contras, imposing strict censorship of the press and closing media outlets.

In August 1982, the Rev. Bismark Carballo, director of Catholic Radio, was arrested by Sandinista police, stripped naked and taken to a police station. The official press at the time said he had been attacked by a jealous husband who found the priest with his wife.

At about the same time, Bishop Pablo Antonio Vega and four priests were expelled from Nicaragua, accused by the government of helping the U.S.-backed Contras.

A businessman allied with the opposition, Jose Castillo Osejo, charged that he was taken to Borge's office and was beaten by the minister.

Borge also imposed strict censorship on La Prensa, whose director, Violeta Barrios de Chamorro, ended Sandinista rule by being elected president in 1990.

During Borge's time in power, the government created Sandinista Defense Councils known as "the eyes and ears of the revolution" which exist today as Citizen Empowerment Councils run by Murillo, the wife of Daniel Ortega who is secretary of communication and citizenship.

In 2011, Borge's former assistant minister, Luis Carrion, said the interior ministry was behind a 1984 bomb attack that killed three journalists and four rebels at a news conference in neighboring Costa Rica.

While the bombing was once blamed on the U.S. Central Intelligence Agency, Carrion said that it had been part of a plot by the Sandinista government to kill Contra rebel leader Eden Pastora, who was giving the conference. Pastora survived.

Borge denied involvement in the attack, which killed two Costa Ricans, four Nicaraguan rebels and U.S. journalist Linda Frazier and wounded more than 20 other people at the village of La Penca, near the Nicaraguan border.

Pastora lauded Borge on national television Tuesday, saying he had become godfather to Borge's daughter and considered the former interior minister to be "immortal, incorruptible, a man who didn't lie."

"He was tough and tender, the new man that we were trying to build," Pastora said. "A lover of reality and truth."

The reputations of Borge and other Sandinista officials were also hurt by what Nicaraguans called the "pinata" — the hurried distribution of confiscated properties to Sandinista officials in the weeks before they left office after losing the 1990 election.  A former comrade, poet and priest Ernesto Cardenal, wrote a book alleging that Borge was a millionaire, something he vigorously denied.

After Barrios de Chamorro's 1990 election victory, Borge became a congressman for the Sandinista National Liberation Front and was serving as ambassador to Peru when he fell ill.

Borge is survived by his second wife and four children.