PARIS — A gunman opened fire in the picturesque city of Strasbourg on Tuesday night, killing at least three, wounding a dozen and sending terrorized shoppers and tourists scrambling for safety in the middle of France’s biggest Christmas market.

The assailant, previously flagged by the authorities as a potential threat, escaped police officers who quickly descended on the downtown Strasbourg market’s cobblestone streets after the shooting started, shortly before 8 p.m., and ordered people to stay inside.

Hours later, the assailant remained on the loose as the police expanded their manhunt to the city’s periphery. Government officials said they were investigating the shooting as a possible terrorist attack.

The shooting immediately recalled the Islamic State and Al Qaeda assaults that have haunted France and other European countries over the past several years. It came just as France was grappling with a crisis over the violent Yellow Vest economic protests that have roiled Paris and other French cities for the past four weekends.