A Special Forces soldier entered a closed National Guard armory building in Baltimore County on Monday morning, authorities said, setting off an alarm and starting a standoff with heavily armed police that went on for several hours.

The soldier was safely taken into custody Monday afternoon, Baltimore County police said. They said he is likely to face trespassing charges.

The soldier tripped an alarm at the Gunpowder Military Reservation about 11 a.m., Maryland National Guard spokesman Col. Charles S. Kohler said. The Army called Baltimore County police for help.

Because police didn’t know whether the soldier had access to weapons stored at the armory, they sent a tactical team and a negotiation team.