A celebrity photographer who briefly dated Britney Spears at the height of her career meltdown was sentenced to 45 days in jail on Friday after clashing with an official trying to serve him a restraining order.

Adnan Ghalib, 37, one of the paparazzi who trailed Spears night and day in 2007, was also ordered to complete an anger management program.

Los Angeles prosecutors alleged that in February Ghalib drove his car toward an official who was trying to serve a court order keeping him away from Spears and her family.

Ghalib pleaded guilty to leaving the scene of an accident, and charges of assault were dropped.

Spears, now 27, began a relationship with Ghalib in December 2007 when her private and public life were falling apart following her divorce, stints in rehab and a notorious head shaving incident.

Her behavior improved after the singer's father intervened and was given control of her business and personal affairs by the Los Angeles courts in January 2008.