Nassau County on Tuesday agreed to purchase the Morrelly Homeland Security Center in Bethpage, where the county’s Office of Emergency Management and Police Department lease space, for about $6.4 million.

The county bid $4,020,000 for the three-story, 87,000-square-foot building on Grumman Road West — enough to pay off the $3.99 million second mortgage on the bankrupt property. Nassau, the only bidder, also must pay off the initial $2.4 million property mortgage.

New York Commercial Bank foreclosed on the building last year after the property owner, Applied Science Center of Innovation and Excellence in Homeland Security Research, defaulted on its mortgage.

Nassau County Executive Edward Mangano said the purchase ensures that county police and emergency services “can continue without disruption in the event of a man-made or natural disaster.”

The county will use Police Department asset-forfeiture funds to pay two thirds of the purchase costs; the rest will come from unused capital funds, Mangano said.

The county legislature is expected to appropriate the asset forfeiture funds at an upcoming meeting, a spokeswoman said.

advertisement | advertise on newsday

“This transaction represents a major win for Nassau County taxpayers,” said presiding officer Norma Gonsalves. “The county will now own the building that houses Nassau’s vital homeland security offices, and we will be purchasing it for nearly half of its appraised $12 million value.”

The homeland security building was built in 2010 using a $20 million state grant. The legislature and the Nassau Interim Finance Authority, a state monitoring board that controls the county’s finances, authorized the county to bid up to $10 million for the property.

Several police special units will relocate to Morrelly’s vacant third floor. The department already occupies 1,900 square feet there while OEM has 5,200 square feet on the first floor.

The county also will negotiate with several private sector tenants who occupy 40 percent of the space on the second floor, Mangano said. While the companies’ lease with Applied Science terminated with the sale, Mangano said the county would be willing to act as their landlord.