A secret deal by Malaysia Prime Minister Najib Razak to secure the release of the remains of passengers of downed Malaysia Airlines (MAS) Flight MH17 ended successfully yesterday, accomplishing what days of intense international pressure by global leaders failed to do.

A train carrying nearly 300 bodies reached the Kiev-controlled city of Kharkiv in the evening, hours after the plane's two black boxes - one containing the flight data recorder and the other the cockpit voice recorder - were handed over to Malaysian officials.

The breakthrough came five days after the jet was purportedly hit by an anti-aircraft missile over war-torn eastern Ukraine, killing all 298 people on board.

"These were extraordinary circumstances which called for extraordinary measures. There were risks involved in pursuing this agreement," said Najib yesterday without giving further details about the risks or the terms of the deal.

A report by Reuters yesterday said the separatists made two demands: one, for a signed document to say the black boxes were not tampered with, and two, that the recorders not be handed over to the Ukrainian government.

The agreement surprised many people when it was announced just after midnight on Monday.

Many top officers in the prime minister's Office and the Malaysian foreign ministry were not aware of it as it was a closely-held secret.

Some had earlier wondered why the 60-year-old premier was guarded for days in his response to the crisis. He disclosed on Monday night that he held his anger in check so as to "work quietly in the service of a better outcome".

Najib was won praise for the breakthrough, even from opposition figures in Malaysia. "The Prime Minister, Najib Razak, is to be commended for the breakthrough," said veteran opposition leader Lim Kit Siang.

News pictures flashed around the world showed rebel commanders handing over the two black boxes and exchanging documents with Malaysian officials in Donetsk, the largest city of the self-proclaimed Donetsk People's Republic.

In perhaps an indirect response to critics that he negotiated with "terrorists" - a term used by the Ukraine government to describe the separatists - Najib said yesterday: "We felt an obligation to explore all avenues to break the impasse and secure the return of the remains and the black boxes.

"After meeting the families, I felt that we owed it to them to act."

While Najib has succeeded where more powerful leaders have failed, observers said there would inevitably be questions about the precedent set by Malaysia's top leader negotiating directly with a separatist leader like Alexander Borodai, the self-proclaimed prime minister of the Donetsk People's Republic.

But experts said the unusual negotiations with the separatists did not mean Malaysia recognised the rebellion.

Dr Oh Ei Sun of the S. Rajaratnam School of International Studies in Singapore said Malaysia was merely being pragmatic.

"It's a measure of peaceful last resort in an abnormal circumstance," he told The Straits Times yesterday.

Others pointed out that Malaysia regularly negotiates with Abu Sayyaf terrorists in southern Philippines to release its citizens or tourists who have been kidnapped, without acknowledging their political aims.

To other observers, the deal with Malaysia, which lost 43 of its nationals in the disaster, was a face-saving measure for Russian President Vladimir Putin and the pro-Moscow separatists.

The alternative - to hand over the remains and blackboxes to international investigators - would have made it seem as if Putin and the rebel commanders had wilted under threats of sanctions from the United States and European countries.

Putin might also have helped in the deal, observers said, as Malaysia is among countries closest to Russia in Southeast Asia, with purchases of MiG jet fighters in 1995 and Sukhois in 2003. Part of the purchases was paid with Malaysian palm oil.