An active shooter drill gone awry sparked panic and prompted a lockdown at Walter Reed National Military Medical Center in Bethesda, Maryland, Tuesday afternoon, multiple sources told ABC News.

Military police tweeted an alert about 2:15 p.m. of a possible active shooter and were searching through buildings, and calling in the Montgomery County Police to help.

A large contingent of police swarmed the hospital, as the facility's gates were closed and people were asked to shelter in place.

But just after 3 p.m., the Department of Defense confirmed that it was only a drill. A source told ABC News that the exercise was mistaken for an actual threat and personnel initiated emergency procedures.

Lt. Col. Audricia Harris, a spokesman for the Department of Defense, confirmed, "It was a drill."

The U.S. Navy released a statement that said the incident was "the result of the improper use of a mass notification system by a tenant command aboard the installation."

"While preparing for an upcoming drill, the notification system was inadvertently enacted without containing the words "EXERCISE" or "DRILL." Individuals who saw the mass notification statement immediately notified NSA Bethesda security, where they responded accordingly and instituted an installation-wide active shooter response. On further investigation, they determined that the improper use of the system was the root cause and secured from the active-shooter response."

It was at least the second time this year that a drill prompted real-life panic at a U.S. military base.

On Aug. 2, a training exercise at the Wright-Patterson Air Force Base in Dayton, Ohio, caused an emergency active shooter response, prompted a lockdown, the evacuation of a hospital and led one security force member to open fire on a locked door to get it open.

Officials at Wright-Patterson AFB issued an all-clear notice roughly two hours after security forces were put on high alert, writing on Twitter, "There was no real world active shooter incident on Wright-Patterson AFB and base personnel remain safe."