Once ranked among America’s worst bicycling cities, Boston has cleaned up its act in recent years, becoming a safer place to bike to work, according to a Harvard Chan School study of injuries to bicycle commuters between 2009 and 2012.

That finding comes despite a rise in the overall number of bicycling accidents and a plateau of accidents with injuries because of a rapid increase in the number of bicyclists on Boston’s roads. The study found the accident rate — the chances of any single cyclist being involved in an accident — held steady and the rate of accidents with injuries fell significantly, from 82.7 percent of all bicycling accidents in 2009 to 74.6 percent in 2012.

The change translated to a 14 percent annual drop in the chance of getting injured in a bike accident in Boston, according to the study. Researchers said the change was likely evidence of a “safety in numbers” effect. With more bicyclists on the road and better bicycling infrastructure, they said, drivers may be more aware of cyclists and on the lookout as they navigate city streets.

“The more bikers are on the road, the more drivers are aware of bikers on the road instead of not thinking about it,” said Felipe Pedroso, a former master’s student at the Harvard T.H. Chan School of Public Health and the study’s first author.

The study period coincided with a time of rapid change in Boston’s cycling landscape. The most dramatic was an increase in the miles of bike lanes from almost nothing — less than a mile — in 2007 to 92.2 miles in 2014, a shift that researchers said was a likely factor in heightening drivers’ awareness of bicyclists. In addition, bicycle commuters’ numbers almost tripled from 2005 to 2014, from 0.9 percent of all commuters to 2.4 percent.

How to protect cyclists

The study, published in December in the American Journal of Public Health, began as a classroom project for Pedroso, who graduated in May and is currently a surgical resident at Columbia University Medical Center. Pedroso, who described himself as an avid cyclist, said he found Boston a bike-friendly city and wondered how its bike infrastructure had changed over time. The classroom project grew into a scientific research paper when Kathryn Taylor, a visiting scientist at the School, urged him to delve further into the subject.

With the city encouraging cyclists to hit the roads in greater numbers, Taylor said she wondered whether seeking to solve the problems of car-clogged city streets and residents’ sedentary behavior had created another: more hurt cyclists.

“Are we creating a problem rather than curing a problem?” Taylor said.

Using publicly available databases, Pedroso used accident statistics from the Boston Police Department, factored in the number of bicycle commuters from the U.S. Census Bureau’s American Community Survey, and learned the miles of bike lanes from the Massachusetts Department of Transportation.

He used the rapid increase in the miles of bike lanes as a proxy for improvements in bike-friendly infrastructure in the city — including the Hubway bike-sharing program, improved signage, and education programs — and found that the decline in the accident-with-injury rate was associated with the improved bicycling infrastructure in the city.

“Giving bicyclists an established lane gives them legitimacy for being on the road,” Taylor said.

The study also looked at specific characteristics of bicycle accidents and found that the vast majority — 91.9 percent in 2012 — involved a car and that 11.3 percent that year were caused by an opened car door, the “dooring” cyclists dread on roads lined with parked cars. Other categories involved accidents with pedestrians, with other cyclists, and the bicyclist alone.

Taylor, who was the study’s senior author, said the most surprising finding to her was that wearing a helmet was more common in injury-related accidents. Taylor said that might be an indication that helmeted riders engage in more risky behavior because they feel protected. She said there is too little evidence, however, to conclude that the reassurance that comes with wearing a helmet increases the chance of injury because data on the type of injury — particularly whether a head injury was involved — was not included.

“We don’t know whether it’s a lower-extremity injury. Maybe the helmet served its purpose,” Taylor said.