Quote Quoting VC 21755. Pass on Right Safely
The driver of a motor vehicle may overtake and pass another vehicle upon the right only under conditions permitting such movement in safety. In no event shall such movement be made by driving off the paved or main-traveled portion of the roadway.
You do have the right to contest the ticket and try to argue that what you did was safe. If you do so, I suggest getting an aerial picture from Google Maps (or equivalent) and some photos, so your case is understandable to the court.