TORONTO (AP) — Canadian Prime Minister Justin Trudeau formally apologized Wednesday on behalf of his nation for turning away a ship full of Jewish refugees trying to flee Nazi Germany in 1939.

The German liner MS St. Louis was carrying 907 German Jews fleeing Nazi persecution and it also had been rejected by Cuba and the United States. The passengers were forced to return to Europe and more than 250 later died in the Holocaust.

Trudeau called the apology long overdue.

Hitler "watched on as we refused their visas, ignored their letters and denied them entry," Trudeau said in Parliament.

"There is little doubt that our silence permitted the Nazis to come up with their own, 'final solution' to the so-called Jewish problem."

He said lawmakers at the time used Canadian laws to mask anti-Semitism.

"We let anti-Semitism take hold in our communities and become our official policy," Trudeau said. "To harbor such hatred and indifference toward the refugees was to share in the moral responsibility for their deaths."

In the run-up to World War II and the ensuing Holocaust, the government heeded anti-Semitic sentiment and severely restricted Jewish immigration. From 1933 to 1945, only about 5,000 Jewish refugees were accepted.

The ship arrived in Canada more than six months after the Nazis in Germany attacked Jewish homes and businesses, burned 250 synagogues and killed at least 91 people, on a night which came to be known as Kristallnacht, "The Night of Broken Glass."

Before the apology, Trudeau met with Ana Maria Gordon, a St. Louis passenger who lives in Canada, to talk about how the country could fight anti-Semitism.