Police stopped cyclists in downtown Montreal Wednesday morning to warn them that riding a bicycle with headphones or earplugs is illegal.

At an event that police invited the media to attend, officers stopped cyclists and handed out what they called "courtesy warnings" at the corner of Rue Stanley and Boulevard de Maisonneuve, telling riders that breaking the rule could lead to a $52 fine.

Quebec's highway safety code prohibits riding a bicycle while wearing a personal stereo headset or earphones. It's the only Canadian jurisdiction where it's illegal to ride while listening to headphones.

In the U.S., Florida and Rhode Island have made it illegal to use headsets while cycling. California, Maryland and Delaware also regulate use of headphones or earbuds. In those states, cyclists must leave one ear uncovered while riding.

Cyclist Yannick Hauptman told CBC News that he had no idea he was disobeying the law by riding his bike while wearing headphones in Montreal.

The IT technician said the headphones make his ride to work more enjoyable.

"It's better to get music...the time is goes faster, when you are going on the bike," he said.

But after seeing a group of police cadets handing out warnings, Hauptman said he won't put headphones on again.

Police spokesperson Nathalie Valois said that is exactly the sort of impact police want.

She said police have noted an increase in the number of cyclists wearing headphones and feared those numbers would increase if nothing was done.

Valois said that so far this year police in Montreal have handed out 143 tickets to cyclists riding with earphones on in the city. She said 296 tickets were issued for the same infraction last year.

Police will continue to warn cyclists about the hazards of riding with earphones in July and expect to start handing out more tickets in August, she added.

Police said Wednesday that headphones make it more difficult for a cyclist to be aware of their surroundings as they move through traffic and pedestrians.

There were four bike-related deaths in the Montreal area last year, but police said none of them was related to cyclists wearing headphones while riding. Under Quebec's Highway Safety Code, cyclists cannot:

Ride a bicycle with a braking system in poor condition.

Carry a passenger, unless the bicycle is equipped with a fixed seat for this purpose.

Ride between two adjacent moving lanes of traffic.

Ride on a sidewalk.

Alter, replace or remove a bicycle's serial number.

Drink alcoholic beverages when cycling.

It is also prohibited for children under age 12 to cycle on roads where the speed limit is above 50 km per hour, unless they are accompanied by an adult or using a bicycle lane.