MONTREAL — Thousands of residents in Quebec, Ontario and New Brunswick were evacuated from their homes after days of flooding that spurred Montreal and Ottawa to declare a state of emergency and prompted the intervention of Canada’s Armed Forces to help residents.

Over the weekend, a dike was breached in Sainte-Marthe-sur-le-Lac, Quebec, a suburb west of Montreal, sending 5,000 residents fleeing to higher ground, some frantically scooping up their small children, pets and valuables as water came as high as their waists.

Video footage showed a man in a life jacket in a small boat paddling down a street submerged in water. The breach startled residents, many of whom were sitting down for dinner.

No one has been seriously injured in the flooding, and the urban centers in Ottawa and Montreal are largely free from danger.