North and South Korea reached an agreement early Tuesday to resolve the showdown on the divided peninsula, with Pyongyang promising to express regret for recent provocations, including a land-mine attack that severely injured two South Korean soldiers.

In return, Seoul agreed to turn off the loudspeakers that have angered Pyongyang so much that it had entered what the North called a “quasi-state of war.” Shortly after noon Tuesday, South Korea announced that it had stopped the broadcasts.

The deal came after three days of marathon talks during which North Korea was moving troops and military equipment to the border, apparently trying to signal that it was ready for combat, while South Korea declared that it would retaliate against any provocation.

Initial details suggested that the deal was a win for South Korea, although it fell short of the full-throated apology Seoul wanted from Pyongyang for the attack this month in which two soldiers stepped on a North Korean box mine on a known patrol path just over the southern side of the border. One soldier lost both legs, while the other lost one.

Kim Kwan-jin, the South Korean president’s national security adviser, told reporters in Seoul shortly after 2 a.m. that North Korea’s willingness to express regret was “very meaningful.”

“We expect the two sides will implement the agreement in good faith and create trust through dialogue and cooperation,” Kim said, according to the Yonhap News Agency.

North Korean leader Kim Jong Un’s regime also promised not to stage any more provocations and said it would start talks to allow the resumption of reunions between relatives who were separated when the division of the Korean Peninsula was cemented at the end of the Korean War. The estranged neighbors said they would continuing talking to try to resolve other differences.

“We welcome this agreement and are hopeful it leads to decreasing tensions on the peninsula,” said John Kirby, a State Department spokesman, although he also said the United States would judge North Korea by its actions.

Ban Ki-moon, the U.N. secretary general and a South Korean, said he hoped that the ­inter-Korean talks would “lead to the resumption of talks for addressing the nuclear issue.”

Although Pyongyang promised only to express regret for the injured soldiers and did not take responsibility for causing the injuries, the concessions made by the North underscore the lengths to which Kim’s representatives were prepared to go to silence the loudspeakers. They had been blaring messages into North Korea that amounted to outrageous treachery, at least to regime ears.

“Kim Jong Un’s incompetent regime is trying to deceive the world with its lame lies,” a kind-sounding woman would say in a slow, deliberate voice emanating from one of the banks of 48 speakers set up along the South Korean side of the military demarcation line. The messages can travel about 12 miles at night and about half that distance during the day, well into North Korean territory.

Another message noted that Kim Jong Un, who took over from his father, Kim Jong Il, at the end of 2011, hasn’t traveled abroad as leader or met a single foreign head of state.

“President Park Geun-hye has . . . visited many countries since she became the president, including three visits to China,” one of the recorded messages says, referring to the South Korean president and her close relationship with Beijing, North Korea’s supposed patron. “However, Kim Jong Un hasn’t visited any other countries in the three-plus years since he became leader.”

The speakers also play peppy southern K-pop songs such as “Tell Me Your Wish” by Girls’ Generation. (“Tell me your wish, tell me your little dream, imagine your ideal type in your head, and look at me, I’m your genie, your dream, your genie.”)

In North Korea, state media holds up the ruling Kim family as demigods, raving about their miraculous feats and broadcasting such songs as “Our Leader Loved by the People.” The regime indoctrinates children into its personality cult beginning in kindergarten and strictly controls the flow of information into the country.

“For the North Koreans, the broadcasts are dangerous, because this is about the survival of the regime,” said Chun Yung-woo, a former South Korean nuclear negotiator who has sat across the table from North Korean negotiators on many occasions.

“They are worried that this could destroy the soldiers’ loyalty to the ‘supreme leader’ and shake their faith in the system that’s central to regime survival,” Chun said.

But John Delury, an associate professor at Yonsei University in Seoul, said the idea that any North Korean soldiers would defect because of overt propaganda they had heard over the loudspeakers was “laughable” and that there were much more effective ways to be subversive.

But, he added, it is hard to overestimate how fundamental the dignity of the leadership is in North Korea’s political system.

It’s “what makes the whole place tick,” Delury said. “From their perspective, the speakers are slandering their leader and it’s reprehensible, so everyone involved needs to be able to report back to Pyongyang: ‘I just screamed at the South Koreans for 24 hours and told them to take the speakers down.’ ”

Both Koreas routinely blasted messages at each other until 2004, when, during the “sunshine policy” period of improving ties, both agreed to take down their speakers.

However, after blaming the North for the 2010 torpedoing of the South Korean warship Cheonan, which killed 46 sailors, Seoul ordered that the speakers be reinstalled at 11 locations. North Korea threatened to turn Seoul into a “sea of fire,” and the speakers had not been turned on until this month.

Earlier, as the marathon talks continued Monday, Park, the South Korean president, said that her government would “continue the loudspeaker broadcasts” unless North Korea apologized and promised not to stage any more provocations.

Seasoned American and South Korean diplomats said they doubted that Pyongyang would issue an apology, noting that it had spent 60 years denying responsibility for its actions in the face of overwhelming evidence. Not only did the North deny responsibility for the land-mine and Cheonan attacks, but it also denied starting the war in 1950.

But this “modest agreement” constituted an indirect admission of responsibility for the incident, which North Korea had denied prior to the talks, said Scott Snyder of the Council on Foreign Relations.

“Both sides have also shown that they have the wherewithal to negotiate their way out of a crisis,” he said. “For this reason, the test of whether this agreement marks a real turning point in inter-Korean relations will lie in the ability of both sides to keep their agreements and to institutionalize future dialogue and cooperation.”

Yoonjung Seo in Seoul contributed to this report.