The American Civil Liberties Union (ACLU) has accused US police of spying on thousands of social media posts of Muslims and African Americans in Boston.

The ACLU of Massachusetts said on Wednesday that the Boston Police Department used an online surveillance system, called Geofeedia, from 2014 to 2016 to spy on online comments from Muslims and African Americans, presstv.ir reported.

"The BPD treated ordinary citizens discussing ordinary affairs as justifiable targets of surveillance," the group said in a statement.

"What it did not do … was deter or help solve serious crimes,” it added.

The Boston police monitored on African Americans and Muslims by creating online alerts for the use of innocuous Arabic words and the hashtags #BlackLivesMatter and #MuslimLivesMatter, the civil rights group said.

The ACLU report was based on documents obtained through a public records request. The report said police treated people as suspicious on the basis of their race, religion and ethnicity.

"The records demonstrate the clear need for both transparency and procedural safeguards to ensure that this type of software is subject to public scrutiny and ongoing oversight before it is used again,” it said.

Civil rights activists have used the hashtag #BlackLivesMatter to highlight US police’s brutality against African Americans. In 2013, the hashtag gave birth to the Black Lives Matter movement, which has campaigned against violence and systemic racism towards black people in the United States.

#MuslimLivesMatter was created after three innocent Muslim students were shot and killed by a middle-aged white man in North Carolina in 2015.

Craig Stephen Hicks shot dead Deah Shaddy Barakat, 23, his wife Yusor Mohammad Abu-Salha, 21, and her sister, Razan Mohammad Abu-Salha, 19, near the University of North Carolina at Chapel Hill campus on February 10, 2015.

According to autopsies, Barakat was shot multiple times in the head and chest after he answered the door to his apartment.