The town of Ayer, Massachusetts is located approximately 35 miles west of Boston. Ayer has a population of 7,287 and a total area of 9.6 square miles. The town was home to Fort Devens, a Civil War army camp, until its closure in 1994. Ayer is part of Middlesex County. The Ayer District Court is located at 25 East Main Street and serves the following municipalities: