Armed followers of a former army major who seized a remote police station in southern Peru have surrendered after a four-day stand-off, officials say.
Humala's group looks to Peru's Inca past for inspiration
Some 150 men held the station in Andahuaylas despite the arrest of their leader, Maj Antauro Humala, on Tuesday.
The rebels had called for President Alejandro Toledo to quit, accusing him of "betraying" Peru.
All 17 hostages held since Saturday were freed unharmed, but four policemen were killed during clashes.
Maj Humala now faces charges relating to kidnapping and also the policemen's deaths.
He has been flown to Peru's anti-terrorist headquarters in the capital, Lima, for further questioning.
If found guilty, he faces up to 20 years in prison, according to the head of Peru's Constitutional Court.
One rebel was also killed during the stand-off.
The rebels said they were simply trying to defend the country's interests against corruption and foreign influence, the BBC's Americas editor Paul Keller says.
Maj Humala has been flown to Lima for questioning
Surrounded by Peruvian troops and with their ammunition running low, the rebels realised they had no chance of escape, the BBC's South America correspondent Elliott Gotkine reports.
They finally laid down their weapons, released their hostages and surrendered to the authorities.
Maj Humala had earlier withdrawn an offer to surrender after Peruvian forces surrounded the police station and threatened an attack against the rebels.
An assault was only prevented after a request by the country's human rights commission.
In 2000, Maj Humala's brother, Ollanta, led a short-lived military rebellion against the government of former President Alberto Fujimori, and was briefly imprisoned before being pardoned.
This time, the rebels are accusing the unpopular Mr Toledo of corruption and of selling out to business interests in Chile, which is Peru's historic rival, correspondents say.
The Peruvian government condemned the attackers as subversives, while some sections of the press painted them as muddle-headed right-wing militants, our Americas editor says.
He says Maj Humala is the head of the self-styled Etnocacerista Movement.
The movement takes its name from a former Peruvian President Andres Avelino Caceres, who led the resistance against Chile after the 19th-Century War of the Pacific.
The group - reportedly made up of veterans of Peru's conflicts with Ecuador and against leftist rebels - aims to establish a nationalist indigenous movement modelled on the ancient Inca Empire, correspondents say.
Maj Humala demanded the creation of a new republic that would - among other things - break all commercial links with Chile and re-nationalise the country's industry.