CALGARY -- Calgary's mayor says Canadian Pacific Railway has apologized for the chaos caused by a train that derailed after a bridge over the swollen Bow River failed Thursday.

Emergency crews were working to pump all of the oil products off six tanker cars that were teetering on the broken bridge, a process that was expected to take until Friday.

Naheed Nenshi initially lashed out at the railway, saying he had concerns about the timing of the bridge inspection in relation to flooding that swamped the city. He also wondered why railways are exempt from municipal regulations.

Railways are under federal jurisdiction and are responsible for their own inspections.

"How is it we don't have regulatory authority over this, but it's my guys down there risking their lives to fix it?" Nenshi asked.

"Certainly once this crisis is over, I'll be looking for a lot of answers from a lot of people."

But by afternoon, after a conversation with CP (TSX:CP) CEO Hunter Harrison, the mayor softened his stance.

"He extended an apology to the citizens of Calgary for what has happened here," Nenshi said. "We both agreed, No. 1, our primary responsibility is to get this thing cleaned up and, No. 2, that we will work together much more and he reiterated safety in every community CP Rail runs through is a primary responsibility.

"I was happy to hear that commitment and now we'll see how well we're able to fix this problem."

CP (TSX:CP) issued a statement Thursday morning that said the bridge had been inspected on Saturday and the tracks on Monday. However, Harrison later told reporters the bridge was inspected five times after floodwaters rose. And CP engineers at the scene said the bridge had actually been inspected 18 times since flooding began.

Harrison said it was "clearly" a failure of piers at the bottom of the river. The engineers blamed it on fast water scouring away gravel under the support.

"We couldn't have seen anything from an inspection on top unless there was severe movement as a result of the failure down below," Harrison said. "We would normally have probably put divers in to inspect, but the current was too fast. Somebody would have drowned if they had tried to go in there, plus the current was so fast, and it's so murky, you couldn't do an appropriate inspection."

The rail company didn't anticipate "a problem like this occurring at all," said Harrison, who said it would have been "jeopardizing commerce" to hold back trains until divers could get in.

He also said the bridge's failure was as "extraordinary" as the heavy rains and flooding in southern Alberta. The bridge was built in 1912 and hasn't had a failure like this since 1944, he noted.

Nenshi wondered if recent layoffs at CP had anything to do with the situation.

"I'll be very blunt. I'll probably get in trouble for saying this," Nenshi said. "We've seen a lot of people lose their jobs at CP over the last year. How many bridge inspectors did they fire?"

The company, however, said the number of bridge inspectors remained the same.

The derailed cars were carrying a product used to dilute raw oilsands bitumen. The product is also used as a solvent used in metal polishes, paint thinner, oil-based stains and paint.

Jeff Gaulin of Tervita Corp., the derailment emergency response experts brought into handle the situation, said late Thursday that four cars still needed to be pumped out, one had been cleared and one was empty from the get-go.

"Once that's done, we'll have a crane on site ... when we will actually be lifting off the trains by crane off the tracks, putting them on land and putting them on transport to move them offsite."

Gaulin estimated the cars would be drained by Friday morning and that removal of the wreckage would take a couple of days.

"We're very confident they can be taken care of without leakage and they can be removed safely," he said. "We've been quite fortunate that ... the situation was stabilized quite quickly. There was minimal risk either of leakage or of collapse, but we've been on site prepared for just about anything."

Acting Calgary fire chief Ken Uzeloc said crews had strung a cable through the railcars and secured it to another train carrying rocks so that if the bridge gave way, the cars wouldn't be carried down the river.

Bruce Burrell, Calgary's emergency management director, said booms were placed down river in case of any spills.

The primarily industrial area around the derailment was evacuated, including the city's sewage treatment plant. Nenshi said staff had to leave because of the evacuation and there was no one left to treat the raw waste water now flowing through the plant. He said the city's water supply was safe, though. A major highway, Deerfoot trail, was also shut down for much of the day.

Federal NDP transport critic Olivia Chow said the federal government has to stop allowing rail companies to conduct their own inspections.

"They can do their own inspections, but the federal government -- or some level of government -- need to inspect bridges," she said.

"Mayor Nenshi is absolutely correct. He was being very polite, but it's the municipal government's personnel whose lives are on the line and yet they have absolutely no say whether these bridges are safe or not."

In 2008, two separate advisory panels made 70 rail safety recommendations. A House of Commons standing committee expressed serious reservations about the so-called Safety Management System, under which much of the responsibility for safety was devolved to rail companies.

The committee made several recommendations to modify the system and legislation was eventually passed.

But Chow said not enough has been done.

"There are fewer inspectors today than there were a few years ago."

Chow said $3 million was cut from rail safety in the most recent budget, which followed a $500,000 cut the previous year.

In an emailed statement, Transport Minister Denis Lebel said the department is responding.

"The Transportation Safety Board of Canada is onsite to conduct a full investigation to determine the cause of the accident," he said. "A Transport Canada ministerial observer will be present to report back on the investigation's progress.

"Transport Canada is increasing oversight in southern Alberta as a prudent and precautionary measure."

Transportation Safety Board investigator James Carmichael said CP will be asked about its protocol for inspecting lines after floods.

"All the bridges, track, railcars, locomotives -- they all are required by Transport Canada to be inspected regularly and I don't have all the time frames on all the stuff with me at the moment," he said. "We are going to gather all the records from all the inspections that have recently taken place.

"We're here to find out what happened and why and how to prevent it from happening again -- or at least mitigating any circumstances where it could happen again."

Alberta Transportation Minister Ric McIver said discussions around rail jurisdiction and CP inspections were for another day.

"I feel very confident that the infrastructure that we have in place is, generally speaking, in very good shape," he said.