TEGUCIGALPA, Honduras (CNN) -- Honduran President Jose Manuel Zelaya arrived in Costa Rica on Sunday after a military-led coup, a Honduran government official told CNN.
Civilians berate Army soldiers in an armored car near the presidential house in Tegucigalpa, Honduras, on Sunday.
The Honduran military arrested Zelaya early Sunday morning, the same day he vowed to follow through with a referendum that Honduras' Supreme Court had ruled illegal.
"They detained the president and sent him out of the country," the government official said.
A military team entered the president's residence and met resistance from Zelaya's guards, the official said.
The official at first said Zelaya was injured, but later said it appeared he had not been.
Military guards were seen walking around the capital, but there appeared to be no unrest, according to Radio America.
Zelaya, a leftist elected in 2005, has found himself pitted against the other branches of government and military leaders over the issue of Sunday's planned referendum. It would ask voters to place a measure on November's ballot allowing the formation of a constitutional assembly that could modify the nation's charter to allow the president to run for another term.
His four-year term ends in January 2010, and he cannot run for re-election under current law.
The Honduras Supreme Court had ruled the poll illegal, and Congress and the top military brass agreed, but Zelaya had remained steadfast.
In the end, it appeared the opposition to Zelaya was too great.
The military confiscated the ballots from the presidential residence, in effect canceling the disputed vote.
Meanwhile, the state-run television news station was taken off the air, and there were reports of cell phones and electricity interruptions in parts of the country.
In Tegucigalpa, a growing crowd, including families with children, gathered outside of the presidential residence. Video showed soldiers walking down some of the streets of the capital, and military helicopters flew overhead.
Sunday's events followed a tumultuous week in Honduras, a country where 70 percent of the population lives in poverty.
At the crux of the current political crisis was the referendum. After the Supreme Court ruled the poll illegal, the country's top military commander, Gen. Romeo Vasquez Velasquez, told the president that the military would not support the referendum.
In response, Zelaya fired Vasquez on Wednesday.
The next day, the Supreme Court stepped in again and ruled that the general's dismissal was unconstitutional. Initially, Zelaya referred to the court as the "Supreme Court of Injustice," but later said that Vasquez still held his military post.
Determined to hold the referendum, the president on Thursday led a protest to the military base where the ballots were being housed and took possession of them -- the same ballots that the military seized Sunday morning.
The military ruled Honduras for 25 years, until a democratically elected civilian government came to power in 1982.
Zelaya narrowly won the presidency in 2005 with 49.8 percent of the vote to 46.1 percent for Porfirio "Pepe" Lobo.

