When that ends, Miller will be on probation for one year.
"The victim is in agreement to this plea and the sentence," said Washington County Assistant State's Attorney Duane Gigeous.
Charges of attempted second-degree rape, second-degree sex offense, false imprisonment, battery and two lesser sex offenses were dropped in exchange for the plea.
Defense attorney Mary Riley said Miller thought the girl he struck up a conversation with on Sept. 12 was much older that she was.
"And he thought she was a prostitute," Riley said.
Gigeous said Miller encountered the girl in the area of East North Avenue around 10 p.m. and walked her to the DSS building at 122 N. Potomac St.
Using a key he got while working for Ajax Cleaners, the company that services the building, Miller opened a rear door and took the girl into an elevator to the basement, Gigeous said.
The girl was taken to a storage-supply room and mattresses were pulled onto the floor, according to police reports.
The girl told police the man kept saying he wanted to make love to her and she kept saying "no," and that she wanted to go, police reports said.
The man put his hands on her shoulders, pushed her onto her back and laid on top of her, police reports said. She convinced him to let her go and she went home and called police.