A ceasefire between Thailand and Cambodia has come into effect along the border, where almost three weeks of deadly clashes have forced nearly one million people from their homes.

In a joint statement, the defence ministers of the two countries agreed to freeze the front lines where they are now, ban reinforcements, and allow civilians living in border areas to return as soon as possible.

The ceasefire took effect at noon local time (05:00 GMT) on Saturday. Once it has been in place for 72 hours, 18 Cambodian soldiers held by Thailand since July will be released, the statement said.

The breakthrough came after days of talks between the two countries, with diplomatic encouragement from China and the US.

The agreement prioritises getting the displaced back to their homes and also includes a commitment to remove landmines.

Thailand's Defence Minister Natthaphon Narkphanit described the ceasefire as a test for the other party's sincerity.

Should the ceasefire fail to materialise or be violated, Thailand retains its legitimate right to self-defence under international law, he told reporters.

UN human rights chief Volker Türk expressed hope that the ceasefire will pave the way for peace, while an EU spokesperson urged good faith in its implementation.

Thailand had previously hesitated to accept the ceasefire, citing concerns over the lack of proper implementation of earlier agreements and Cambodia's actions to internationalise the conflict.

Unlike the last ceasefire in July, US President Donald Trump was notably absent from this latest truce, though the US State Department played a role in the discussions.

The previous ceasefire agreement collapsed earlier this month due to new clashes, with both sides pointing fingers at each other for its breakdown.

Clashes persisted throughout December, with reports of air strikes by Thailand against what they described as Cambodian military positions.

Political will, alongside rising nationalist sentiments in both nations, will be crucial in determining the durability of this ceasefire.

The longstanding border disputes stem from over a century of discord, flaring up again after local incidents and a notable clash earlier this year. Multiple ceasefire attempts have been made, but a sustainable peace remains elusive as territories and grievances persist.