SEOUL, South Korea — North Korea on Thursday threatened to cancel reunions of families separated by the Korean War, accusing the United States of flying nuclear-capable B-52 bombers on a training mission over the Korean Peninsula.

North and South Korea agreed on Wednesday to hold the family reunions Feb. 20 to 25, when hundreds of elderly Koreans would be allowed to meet their relatives for the first time since the war ended in 1953.

The deal was widely seen as a sign that relations between the two countries may be warming after threats of war followed the North’s nuclear test early last year. The reunions would be the first since 2010, when the humanitarian program was halted amid souring relations.

But on Thursday, North Korea warned that it could scrap the agreement unless South Korea canceled joint annual military exercises it planned to start with the United States in the last week of this month.