Columbia-based Corporate Office Properties Trust has sold all its facilities in Montgomery County while picking up a new building in Herndon as part of a larger effort to reposition its holdings.

The real-estate investment trust specializes in office space for the military and its contractors, a sector bracing for spending cuts now that the wars overseas are winding down. In response, COPT established a plan to sell off certain properties it considers less valuable.

As of last month, the company said it has sold 58 buildings of 3.2 million square feet and adjacent land for $394 million. COPT has also reduced by almost one-third the number of leases it manages.

“What’s happening with Corporate Office and all of the Washington, D.C., and U.S. government-focused REITs is their stock is clearly in the penalty box until there’s some clarity on the overall government budget,” said John W. Guinee, managing director at Stifel Nicolaus. “They’re taking this opportunity smartly to sell all of their non-core or nonstrategic assets.”

As part of its strategic selling, the company last quarter sold off four Maryland properties, including 231,000 square feet in two buildings on West Gude Drive in Rockville and 240,000 square feet in one building on Tech Road in Silver Spring. It has continued selling this quarter, divesting facilities in Columbia, Hunt Valley and Gaithersburg last month.

Still COPT is directing money to other projects. Roger A. Waesche, Jr., president and chief executive at COPT, said in a call with investors last month that the company has started construction on a new building in Annapolis Junction, near Fort Meade and the National Security Agency, and last month paid nearly $50 million for McLearen Center, a 200,000-square-foot building in Herndon that is home to a defense contractor.

COPT is also grappling with its Manassas-based Power Loft data center, which it bought in 2010 for $115 million. The 233,000-square-foot, two-story facility is only 17 percent leased — nearly the same portion that was leased when it was purchased.

“We made some missteps in our initial marketing of the asset, both in terms of not going after multiple channels and the way we priced the asset,” Waesche said.

Stephen E. Budorick, COPT’s chief operating officer, said in the same call that the company has put in place an expanded marketing strategy and simplified its pricing for the data center.

David J. Cappuccio, an analyst with Gartner, said the data center industry is becoming more competitive, forcing companies to look more closely at their pricing models and the services they offer.

“It’s no longer enough just to build a giant white space and try to fill it up,” he said.