Maoists in India's Orissa state have freed a magistrate abducted earlier this month, the state government says.
The release of R Vineel Krishna was delayed for a few hours.
The reason was that the rebels had insisted that five Maoists due to have been freed in exchange for Mr Krishna should first be handed over to them.
The authorities insisted that they had not "bowed down" to the rebel's demands and that Mr Krishna was now being taken to district headquarters.
Orissa's Chief Minster Naveen Patnaik said that Mr Krishna was on his way back to the town of Malkangiri, a district centre 650km (400 miles) south of the state capital Bhubaneshwar where he has worked as a magistrate.
Witnesses told the BBC that he was handed over by about 18 Maoists on the outskirts of the remote forested area in Malkangiri district where he was being held.
His release was greeted with joy in front of his official residence in Malkangiri, with ecstatic people dancing for joy and letting off crackers.
After three days of talks with the Orissa government, negotiators nominated by the Maoists announced on Tuesday evening that Mr Krishna would be released "within 48 hours".
But on Wednesday the rebels made a fresh demand that five of their number whose release was agreed upon by the two sides be physically delivered to them before Mr Krishna was himself freed.
One of the negotiators on behalf of the Maoists made an appeal on Wednesday for them to honour their deadline via an audio message on BBC Hindi radio.
An engineer kidnapped along with Mr Krishna was freed on Wednesday. Pabitra Majhi is reported to be in good health.
He told doctors examining him that Mr Krishna was also in good health.
The two were seized on 16 February while on their way back after inspecting a government project in the remote Chitrakonda area of Malkangiri district.
For the rebels, who live in the deeply forested areas of southern Orissa, radio is the only way to stay in touch with the world.
The BBC is a particular Maoist favourite for what they call its "fair and objective" reporting.
Mr Krishna, 30, is a graduate from the prestigious Indian Institute of Technology and joined the civil service in 2005. He was appointed to head Malkangiri district 16 months ago.
Prime Minister Manmohan Singh has described the Maoist insurgency as India's biggest internal security challenge.
- 21 February 2011
- 18 May 2010