"When you see this type of violent act, you do not sit around trying to rationalize it or make excuses for it or figure out its root causes," Harper said before leaving London after attending Margaret Thatcher's funeral.
"You condemn it categorically, and to the extent you can deal with the perpetrators, you deal with them as harshly as possible."
Harper's comments appeared to be a direct rebuttal to a CBC interview with Justin Trudeau, in which the Liberal leader said examining the causes of terrorist attacks are important amid the security response.
"We have to look at the root causes," Trudeau said. "Now, we don’t know now if it was terrorism or a single crazy or a domestic issue or a foreign issue.
"But there is no question that this happened because there is someone who feels completely excluded. Completely at war with innocents. At war with a society. And our approach has to be, where do those tensions come from?"
Three people died and more than 170 were injured in Monday's blasts, which investigators believe were the result of makeshift bombs inside pressure cookers packed with nails, ball bearings and metal shards.
Among the victims was 8-year-old Martin Richard of Boston, who was at the race with his family.
"I expressed clearly yesterday and today the shock that I can only imagine that father feels whose son was killed for wanting to give him a hug," Trudeau said Wednesday in response to Harper's criticism.
I really hope that Mr. Harper rethinks the extent and the lengths he's willing to go to personally attack people and to politicize tragedies like that."
Given Boston's proximity to the border, Canadian officials have ramped up security in the wake of the attacks as American officials continue their hunt for clues and suspects in the explosions, which killed three and left 170 wounded.
Harper said the U.S. did not ask Canada to take any specific measures related to the attack.
"All governments, all leaders are following these kinds of violent activities anywhere in the world," he said.
"We're obviously continuing to talk to our American colleagues ... we will be following this closely and do whatever we have to do to adapt."
— With files from Joan Bryden in Ottawa
Note to readers: This is a corrected story. An earlier version incorrectly said Martin Richard was waiting to see his father finish the race.