BANGOR — Bankruptcy court documents say the Books-A-Million bookstore chain has agreed to buy the leases of 14 Borders bookstores, including two in Maine.

Borders Group, the nation’s second largest bookstore chain that once operated over 1,000 stores, announced in July it was liquidating and going out of business.

Citing documents filed in U.S. Bankruptcy Court in New York, the Bangor Daily News says Books-A-Million has agreed to buy the leases of stores in South Portland and Bangor, as well as in New Hampshire, Connecticut, Maryland, Ohio and New Jersey, for about $934,000. The South Portland and Bangor stores are still open.

The agreement must be approved by the court by Aug. 29.

Books-A-Million, based in Birmingham, Ala., has 232 stores in 23 states and Washington, D.C.