NEW YORK - New York City has canceled its annual marathon, Mayor Michael Bloomberg said, as Sunday’s race had become a lightning rod for residents frustrated by the disastrous aftermath of megastorm Sandy.

Bloomberg said the race was being canceled because it had become a “source of controversy and division.”

Critics on Friday ramped up opposition to the mayor’s decision earlier in the week to go forward with the marathon, saying the race would divert critical police and other resources from people in need following the storm.

Some people had set up online petitions calling for runners to boycott the 26.2-mile competition, or to run backward from the starting line in protest.

The New York City marathon is one of the world’s most popular sporting events and, according to pre-storm estimates, was expected to draw about 47,000 runners.

Bloomberg said the race would not require diverting resources from the recovery effort, but that “we cannot allow a controversy over an athletic event - even one as meaningful as this - to distract attention away from all the critically important work that is being done to recover from the storm and get our city back on track.”

Bloomberg said the New York Road Runners Club, the organizers of the race, would have additional information in the days ahead for race participants.