After more than 40 hours of talks, North and South Korea pulled back from the brink Tuesday with an accord that allows both sides to save face and, for the moment, avert the bloodshed they've been threatening each other with for weeks.

In a carefully crafted, though vague, statement, North Korea expressed "regret" that two South Korean soldiers were maimed in a recent land mine blast Seoul blamed on the North. While not an acknowledgement of responsibility, let alone the "definite apology" South Korea's president had demanded, it allows Seoul to claim some measure of victory in holding the North to account.

South Korea, for its part, halted anti-Pyongyang propaganda broadcasts over loudspeakers on the border, which will let the authoritarian North trumpet to its people a propaganda win over its bitter rival, and silence the broadcasts that outside analysts say could demoralize front-line troops and inspire them to defect.

The agreement represents a good first step in easing animosity that has built since South Korea blamed North Korea for the mine explosion at the border earlier this month and began the propaganda broadcasts in retaliation. But, as always on the Korean Peninsula, it's unclear how long the good mood will continue.

Despite South Korean President Park Geun-hye's expression of hope that the North's "regret" will help improve the Koreas' relationship, the accord does little to address many fundamental, long-standing differences. The announcement of further talks to be held soon in either Seoul or Pyongyang could be a beginning, but the Koreas have a history of failing to follow through on their promises and allowing simmering animosity to interrupt diplomacy.

The negotiations that began Saturday at the border village of Panmunjom, where the Koreas agreed to the 1953 cease-fire that stopped fighting in the Korean War, also resulted in Pyongyang agreeing to lift a "quasi-state of war" it declared last week, according to South Korea's presidential office and North Korea's state media.

While the declaration was largely a matter of rhetoric — the border is the world's most heavily armed and there has never been a formal peace agreement ending the Korean War, so the area is always essentially in a "quasi-state of war" — there had been growing worry about South Korean reports that the North was continuing to prepare for a conflict during the talks, moving unusual numbers of troops and submarines to their land and sea border.

The Koreas also struck an important humanitarian agreement by promising to begin talks in September to plan emotional reunions of families separated by the Korean War. The reunions could take place as early as October, considering the time needed to match relatives and agree on a venue, said an official from Seoul's Unification Ministry who didn't want to be named, citing office rules. The Koreas said in the accord that more reunions would follow, but there were no immediate details.

In a signal of North Korea's seriousness, Pyongyang sent to the talks Hwang Pyong So, the top political officer for the Korean People's Army and considered by outside analysts to be North Korea's second most important official after supreme leader Kim Jong Un.

"I hope the two sides faithfully implement the agreements and build up (mutual) confidence through a dialogue and cooperation and that it serves as a chance to work out new South-North relations," chief South Korean negotiator and presidential national security director Kim Kwan-jin said in a televised news conference.

The United States quickly welcomed the agreement and the prospect of tensions dropping.

Kim, the Seoul negotiator, described the North's expression of "regret" as an apology.

Pyongyang had denied involvement in the land mine explosions and rejected Seoul's report that North Korea launched an artillery barrage last week. South Korea's military fired dozens of artillery rounds across the border in response and said the North's artillery strikes were meant to back up an earlier threat to attack the loudspeakers. There were no details on whether the North addressed the artillery claim in Tuesday's deal.

North Korea often makes conciliatory gestures to win concessions and aid from rivals after stoking tensions. The North is now seen as eager to reopen to South Korean tourists, along with pursuing business and investment deals with its more affluent neighbor.

During the talks at Panmunjom, the North Korean negotiators raised the issue of restarting joint tours to the North's scenic Diamond Mountain resort, said the official from Seoul's Unification Ministry.

The tourism project began in 1998 during an era of warmer ties and was a legitimate source of hard currency for the cash-strapped North, but Seoul suspended the tours in 2008 following the shooting death of a South Korean tourist there. Issues related to North Korea's nuclear weapons program or joint military exercises between the U.S. and South Korea, which Pyongyang condemns as a rehearsal for invasion, were not discussed during the talks, the official said.

These were the highest-level talks between the two Koreas in a year, and the length of the sessions was no surprise.

While the Koreas have difficulty agreeing to talks, once they do, marathon sessions are often the rule. After decades of animosity and bloodshed, finding common ground is a challenge. During the latest Panmunjom talks, the first session lasted about 10 hours and the second session about 33 hours.

The negotiations started shortly after a Saturday deadline set by North Korea for the South to dismantle the propaganda loudspeakers. North Korea had declared that its front-line troops were in full war readiness and prepared to go to battle if Seoul did not back down.

South Korean defense officials said during the talks that about 70 percent of the North's more than 70 submarines and undersea vehicles had left their bases and could not be located by the South Korean military. They also said the North had doubled the strength of its front-line artillery forces since the start of the talks.

Kim Min-seok, a spokesman for Seoul's Defense Ministry, said Tuesday that the South Korean military was seeing signs that some of the North's submarines and undersea vehicles were returning to their ports, but he did not elaborate.

___

Associated Press writer Kim Tong-hyung contributed to this report.