A man convicted of having sex on a public beach in Florida in front of a child was sentenced on Monday to two and a half years in prison, a state prosecutor said.

Jose Caballero, 40, was arrested in Bradenton Beach in west-central Florida last July after other beachgoers complained that he was fondling and starting to have sexual intercourse with a woman on the beach in the middle of the afternoon.

A four-year-old child saw the activity, which was videotaped by a witness, a police report said. When her mother asked him to stop, Caballero responded confrontationally, which factored into the sentence requested, said assistant state attorney Anthony Dafonseca.

“His judgment was pretty poor,” Dafonseca said.

Caballero, who previously served about eight years in prison for cocaine trafficking, faced as much as 15 years in prison. His attorney could not immediately be reached for comment.

Both he and the woman involved, 21-year-old Elissa Alvarez, were found guilty of lewd or lascivious exhibition in front of a child, a second-degree felony. Both must register as sex offenders.

Alvarez was sentenced to time served and is now out of custody, Dafonseca said.