A Lawrence police officer has been charged with raping a 13-year-old boy, the Essex County District Attorney’s office said Monday.

Carlos Vieira, 49, of Lawrence, who was arrested in Haverhill, faces two counts of aggravated rape of a child and two counts of indecent assault and battery of a child under 14, prosecutors said.

Officials began an investigation in January when the victim’s mother contacted the district attorney’s office. The mother said that her son, who was 13 at the time, had allegedly met Vieira in the summer of 2018 through a social media app and had engaged in sexual activity with him.