The security planning for last week's Boston Marathon included preparation for a bombing emergency.

We spend months planning for the marathon. We did a tabletop exercise the week before that included a bombing scenario in it," Kurt Schwartz, the state's undersecretary for homeland security, told a panel at Harvard University.

Two bombs went off at the finish line of the race, one of the most-attended sporting events in Boston, where there was a crowd of tens of thousands of spectators.

Given the public nature of the marathon, which is run along a 26.2-mile (42.2-km) course stretching from suburban Hopkinton, Massachusetts, to downtown Boston, security officials said they take into account a variety of possibilities, said Reuters.

Planning rules adopted since the September 11, 2001, attacks on New York and Washington "have forced you to do that, to think about the unthinkable," Boston Police Commissioner Ed Davis told the panel. "When you do that, when you envision what might happen ... you respond in a way that is probably more thoughtful."