LAWRENCE (AP) — A Massachusetts police officer charged with raping a 13-year-old boy who was initially denied bail has had bail set at $75,000.

A judge on Tuesday said Lawrence Officer Carlos Vieira can be freed on bail under certain conditions, but he must first account for one of 20 firearms he owns that remains missing. The rest have been confiscated by investigators.

READ MORE: Taunton Police Sergeant On Administrative Leave After OUI Arrest

Carlos Vieira appeared in Lawrence District Court February 26, 2019. (WBZ-TV)

The 49-year-old Vieira is charged with aggravated rape of a child and indecent assault and battery on a child under age 14 for his alleged encounter last summer with a boy he met on an online dating app.

READ MORE: Georgetown School Officials Investigating Allegation Of Racial Slurs Following Fight During Football Game

He pleaded not guilty and his lawyer calls it a case of mistaken identity.

Officials began investigating in January when the boy’s mother contacted authorities. The department has placed him on administrative leave.

MORE NEWS: Julianne Nicholson, Medford Native, Wins Supporting Actress Emmy For 'Mare Of Easttown'

(© Copyright 2019 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)