A Lowell, Ind., man was sentenced to prison on Thursday for swapping nude photos with a 15-year-old girl he met at a funeral and then began corresponding with over Facebook, the Post-Tribune is reporting.

Lake Superior Court Judge Salvador Vasquez sentenced Sean Bastin, 26, to 18 months in prison for possession of child pornography.

Bastin, 26, admitted in court last month that he knew that the girl to whom he had sent an inappropriate picture was 15 and that he had asked her to send naked pictures of herself. She did send a topless photo.

On Oct. 30, the girls’ parents discovered several messages on the girl’s cellphone that were sexual in nature and called the police.

Defense attorney Jeffrey Semko said his client used poor judgment. “He knows what he did was wrong,” Semko said.

Deputy prosecutor Catherine Breitweiser-Hurst argued for a two-year sentence and said that the victim was being groomed for sexual activity. Bastin met the girl at a funeral for one of her family members, then found her on Facebook and began sending her messages. The girl told Bastin he was too old for her, Breitweiser-Hurst said.

Vasquez told Bastin he should be embarrassed and ashamed of his behavior.

Bastin apologized to the girl and her family and to his family for what he had put them through.

Bastin had faced two to eight years on three counts of child solicitation, which were dismissed under terms of his plea agreement.