Authorities in Thailand have arrested a man they believe is the main suspect in a bombing at a shrine in Bangkok two weeks ago that killed 20 people.

Prime minister Prayuth Chan-ocha said the man is a foreigner and was arrested in eastern Thailand near the Cambodian border.

He described him as the main person in the bombing but did not directly say he is suspected of actually planting the bomb.

He said officials knew from their investigation that people involved in the bombing were about to flee the country and had traced the man to the Aranyaprathet district in Sa Kaeo, a major crossing point to Cambodia.

The prime minister described the man as a piece in a jigsaw puzzle that would connect various parts of the case, which included a bombing the day after the shrine blast that exploded harmlessly in the river next to a busy Bangkok pier.