North and South Korea have reached agreement following marathon talks on ending a tense military stand-off that had pushed the two rivals to the brink of armed conflict.
In a joint accord on Monday (local time), the North "expressed regret" over recent mine blasts that maimed two South Korean soldiers, while the South agreed to switch off loudspeakers blasting propaganda messages across the border.
The speakers will be silenced at midday on Tuesday, at which time the North will lift a "semi-war state" declared last week by leader Kim Jong-Un.
The two also agreed to work towards a resumption next month of reunions for families separated by the 1950-53 Korean War, and to hold official talks in either Seoul or Pyongyang at a date to be decided.
The agreement, which appeared to cover the major areas of contention, came after days and nights of gruelling negotiations which began early on Saturday evening in the border truce village of Panmunjom.
The talks had played out against a dangerous military stand-off, which included a rare artillery exchange over the border last week, and saw both sides ramping up the military rhetoric and flexing their weaponry.
Tensions continued to rise while the discussions were on, with South Korean and US jets flying simulated bombing runs, and North Korea reportedly deploying two thirds of its 70-vessel submarine fleet.
UN Secretary-General Ban Ki-moon "warmly welcomed" the accord which was also published in full by the North's official KCNA news agency.
South Korea's lead negotiator, National Security Adviser Kim Kwan-Jin, said the agreement would settle the current crisis and provide a "new momentum" for inter-Korean relations in the future.
Kim described North Korea's expression of regret for the mine blasts as "very meaningful" and said securing it had taken up most of the time in his negotiations with his North Korean counterpart Hwang Pyong-So - a close confidant of leader Kim Jong-Un.
"We had to get a word of apology that has the North as the main agent," Kim said.
Pyongyang has repeatedly denied any responsibility for the mine blasts, and Tuesday's accord avoided any explicit acceptance of responsibility.
But analysts said it came far closer than they had expected.
"Past inter-Korea agreements at a time like this have tended to be extremely ambiguous," said Jeung Young-Tae, an analyst at the Korea Institute for National Unification in Seoul.
"But in the world of diplomatic language, this is a clear apology, with the object of the regret - the landmine blasts that maimed the soldiers - clearly stated," Jeung said.
Technically, the two Koreas have been at war for the past 65 years since the 1950-53 Korean War ended with a ceasefire that was never ratified by a formal peace treaty.