Spain's high court has handed a ten-month jail term to the officer for "insulting a superior".
The sergeant was being provocative and showing a lack of respect when he "carried out an upwards movement touching the glutes" of the captain, the court found.
The incident occurred on the terrace of a café in the Spanish exclave of Ceuta in 2011, Spain's La Vanguardia newspaper reported on Saturday.
The captain was sitting with a group of other officials including her husband — a lieutenant in the army — after an earlier tense encounter with the sergeant at another Ceuta establishment.
Apparently the captain and the sergeant had a history, with the captain previously having tried the inferior for another serious offence.
On the day in question, the sergeant waited outside the bar until his captain emerged with drinks before touching her buttocks.
He then threatened the seated members of her group on numerous occasions.
Finally the police were called in but the sergeant still managed to attack both the husband of the captain and police officers being finally being dragged away.
He now has ten months to think about his actions.