By David Ljunggren and Mark Hosenball

OTTAWA/WASHINGTON (Reuters) - Canada did not share some intelligence with the United States about two men who mounted fatal attacks last week because of a 2013 court ruling limiting the transfer of personal data, a Canadian official said on Saturday.

U.S. authorities therefore knew little about Michael Zehaf-Bibeau, who killed a soldier on Wednesday before attacking Parliament in the capital Ottawa. They also did not realize that Canada had withdrawn the passport of Martin Rouleau, who ran over and killed a soldier in Quebec on Monday.

The United States and Canada share the world's largest undefended border and for decades have also exchanged information about people deemed to be high risks. Along with Australia, New Zealand and Britain, the two nations belong to the so-called Five Eyes intelligence-sharing network.

But a court ruling last year said the Canadian Security Intelligence Service spy agency was breaking personal privacy laws by passing on data about Canadian citizens.

"That's why CSIS could not share information on this guy, Zehaf-Bibeau, and others with the Five Eyes," the official told Reuters.

"The United States was not aware that the Rouleau passport had been revoked because he was a Canadian national so CSIS couldn't share this information," said the official, who spoke on the grounds of anonymity.

The court ruling last year said Ottawa would have to create legislation if it wanted to allow CSIS to pass on data. Public Safety Minister Steven Blaney said this week that he would address the issue by amending the act of Parliament that governs CSIS.

Pressed as to whether the United States had complained about the lack of intelligence-sharing, the official replied: "I'm not aware of that."

U.S. security officials defended the Canadian record of exchanging counter-terrorism data and said Canada was regarded as a fully participating partner in the Five Eyes group.

"It is unfair to say that the Canadians were slow in providing information about the incident or the individual once he was identified," a U.S. security official said about the attack on Wednesday.

Story continues

"Everybody knew this was a fluid situation, and the information was shared in a reasonable time frame."

Several U.S. officials say they were told by Canadian counterparts that Zehaf-Bibeau was an alias and that the shooter had been born Michael Joseph Hall. The officials say this information turned out to be incorrect.

And a U.S. source familiar with the security file said some government agencies had been frustrated by what they saw as Canada's reluctance to share information on suspects on occasion. The source made clear they were not talking about the two recent attacks.

A spokesperson from the US National Counter-terrorism Center said: "We have a robust information sharing regimen and routinely dialogue on counter-terrorism issues, consistent with our respective countries' laws."

Preventing suspects from sneaking into Canada has been a priority for successive governments since the Sept 11, 2001, suicide attacks in the United States.

In November 2013, an official watchdog said lax controls by border agents and police meant Canada was allowing dangerous people to enter the country, posing a risk to security and safety.

(Reporting by David Ljunggren; Editing by Lisa Von Ahn)