North and South Korea on Friday signed off on an agreement allowing the first train crossing of their heavily armed border in more than 50 years.

The two countries will send two passenger trains — one starting from the North and one from the South — next Thursday, said a statement from South Korea's Defence Ministry.

Trains haven't run between the two sides since rail links were cut in the middle of the 1950-1953 Korean War. Two tracks were reconnected as part of a reconciliation project between the neighbouring countries, which are still technically at war.

The crossing will be a single test run, with regular service unlikely to resume any time soon.

A formal agreement came Friday after 30 hours of extended talks on unspecified sticking points.

South Korea hopes the inter-Korean railways could ultimately be linked to Russia's Trans-Siberian railway and allow an overland route connecting the peninsula to Europe — significantly cutting delivery times for freight that now requires sea transport.

Relations between the countries have warmed significantly since a 2000 summit between their two leaders, but suffered a setback in October of last year when Pyongyang conducted its first-ever nuclear test.

With files from the Associated Press