WASHINGTON — The Pentagon has cleared the way for servicemembers to carry privately owned firearms on Defense Department property, reversing a longstanding rule that barred personal weapons from its facilities.

Troops can apply for authorization to carry a firearm that is not related to their official duties, according to a Pentagon directive issued Nov. 18 by Deputy Defense Secretary Robert Work. The new order also describes the Pentagon’s policies for arming troops and civilian DOD personnel for official duties, such as law enforcement or security.

The directive is the result of a long debate about arming more troops on military installations in the wake of several shootings at Defense Department facilities in the past seven years that have left dozens dead.

Pentagon officials began reviewing the firearms policies in 2009, after a shooting rampage by an Army major on Fort Hood in Texas killed 13 people and injured 30. Last year, debate over arming more troops at military facilities heated up following the July 2015 lone-wolf terrorist attack on two military facilities in Chattanooga, Tenn., that left four Marines and a sailor dead.