A court in Thailand has found two men guilty of carrying out the country's worst ever terrorist attack and sentenced them to death. This was reported by Qazaqyia.kz citing BBC News.

The two men, both from China's Uyghur minority, were convicted of planning and detonating a powerful bomb on the evening of 17 August 2015, next to a shrine in central Bangkok that is popular with foreign tourists. Twenty people were killed and more than 120 were injured.

However, flaws in the police investigation, and in the ten year-long trial of the two men, who both pleaded not guilty, have left questions hanging over this verdict.

The bomb exploded a short distance from the BBC bureau in Bangkok. The blast had ripped through people praying at the Erawan shrine, and knocked over motorbike riders waiting at the nearby intersection, setting some of them on fire.

From the start the official investigation was less than reassuring. Worried about the impact on the all-important tourist industry, the government ordered the scene of the attack to be cleaned up as quickly as possible. The shrine was reopened two days later, the crater left by the bomb cemented over.

Many of the security cameras in the area were found to be not working, but some grainy video did show a man with long hair and thick glasses leaving a backpack under a bench and walking quickly away.

Within two weeks of the attack they had arrested the two men who have now been convicted. Bilal Mohammad was found hiding in a house on the outskirts of Bangkok where the authorities also discovered chemicals suitable for making bombs. He had a forged Turkish passport. Yusufu Mierali was apprehended in Cambodia, and handed over to Thailand.

Both men were identified as Uyghurs, but initially the Thai police said neither was the person who planted the bomb. Later they charged Bilal Mohammad with the crime, although he bore little resemblance to the man in the video.

Unsurprisingly people began to link the bomb to the controversial Thai decision the month before to forcibly repatriate 109 Uyghur men to China, which provoked angry protests by Uyghur sympathisers in countries like Turkey.

But the military government refused to accept this possibility. At one point they suggested it might be disgruntled opponents of the military junta. Later they insisted that it was just human traffickers angry at the government's efforts to shut down their activities.

In a bizarre twist the police offered a reward of $80,000 to anyone who led them to the culprits – then awarded it to themselves once they had their first two suspects in custody.

Both suspects were kept in military custody, and complained that they had been tortured into making confessions. They withdrew these once the trial, in a military court, began.

Bilal Mohammad appeared to be extremely distressed, shouting that he was being mistreated. He testified that he had been waiting at the house where he was apprehended for a smuggler to move him to Malaysia, from where he wanted to fly to Turkey.

Then the delays began. Usually it was because the Thai authorities said they could not find a Uyghur-speaking translator. The defendants rejected those offered by the Chinese embassy. The delays went on and on, for more than ten years.

The International Commission of Jurists is one of several human rights groups which have criticised the procedures and extraordinary duration of the trial, arguing that it was so problematic the two suspects should have been released.

However the judges ruled that there was sufficient evidence to justify convicting them, in particular records of phone calls submitted by the police that show both men near the scene of the crime at the time of the bombing, and communicating with each other.

The lawyer for the two men has said they will appeal against the verdict.