A technical glitch appears to have caused a loud warning system to go off Wednesday morning at the Naval Observatory in upper Northwest Washington, just as a training exercise of how to deal with an active-shooter situation was wrapping up across town at the Washington Navy Yard in Southeast.

Authorities had warned on social media that it was going to run an active-shooter drill starting at 8:30 a.m., and it was expected to last roughly two hours. Drivers, pedestrians and area residents were told they’d likely see police activity and face delays at gates to get onto the grounds of the Navy Yard.

The warning was to prevent any type of panic. In 2013, a lone gunman, Aaron Alexis, fatally shot 12 people and injured three others in a building at the Navy Yard before he was killed by police.

Wednesday’s active-shooter drill was expected to last until 10:30 a.m., but it ended around 9:45 a.m., officials said.

Just as the Navy Yard drill was about to end, however, a loudspeaker, known among Navy officials as ‘The Giant Voice,’ came on at the Naval Observatory, about seven miles away. The Observatory compound is where the vice president resides.

Area residents reported hearing the following message at least three times in about an 8-minute time span: “Attention. Attention. A severe accident has been reported on the installation.”

But it was false. Things were fine at the Naval Observatory and at the Navy Yard, officials said.

“When we were concluding the exercise [at the Navy Yard], our giant voice was saying ‘All clear. All clear,’” said Chatney Auger, a spokeswoman for the Navy District Washington office. “That affected the Naval Observatory.”

How — or why — the glitch happened wasn’t immediately clear, officials said, and they are looking further into the problem.

“There was no incident,” Auger said. “It wasn’t supposed to happen. There was just a glitch in our system.”

Of the problem that caused some near the Naval Observatory to be concerned, Auger said “that’s why we do exercises like this so we can evaluate our preparedness, secured response and communication system.”

“It was a technical error,” she said. “They’re looking into it.”

Gilbert Dunkley contributed to this report.