BERLIN — For a Germany that likes to see itself as meticulous, the slip-up was startling: Hours after the authorities said they had grabbed a suspect in the deadly truck rampage at a Christmas market in Berlin, they acknowledged they may have detained the wrong man and began a desperate search for the actual driver.

The decision on Tuesday to release the suspect and the Islamic State’s claim of responsibility for the bloody attack inflicted a damaging blow to Chancellor Angela Merkel’s government.

On a chaotic day of grief and uncertainty, after 12 people were killed and dozens injured on Monday, leaders of the country’s rising far-right Alternative for Germany party assailed the chancellor in blunt, visceral terms, describing the victims as “Merkel’s dead.”

The attack, which saw a driver steer a speeding tractor-trailer through crowds of shoppers at a popular Christmas market in central Berlin, is already reshaping what promises to be a tumultuous European political year in 2017. Ms. Merkel is the most powerful defender of the reeling European Union, yet such a bloody terror attack on German soil is certain to complicate her campaign for a fourth term in office. The prospect that she could be weakened, or voted out, would be potentially devastating for the bloc.