A French-Canadian university student was identified Monday as the “lone wolf” shooter who killed six people and wounded 19 others as they prayed in a Quebec City mosque — then called 911 to give himself up because he “felt bad,” authorities said.

Canadian Prime Minister Justin Trudeau and Quebec Premier Philippe Couillard labeled the shooting a “terrorist attack,” which came amid heightened tensions worldwide over President Trump’s travel ban on several Muslim countries.

The suspect, Alexandre Bissonnette, 27, was an anthropology and political science student at the University of Laval, the oldest French-language university in North America, a source told Reuters.

Authorities declined to discuss possible motives for the shooting at the Centre Culturel Islamique de Québec. Police said they were confident no other suspects were involved in the attack.

“They consider this a lone-wolf situation,” a source told Reuters. A possible motive for the Sunday night attack was not released.

Bissonnette — who was not previously known to police — lived with his parents in a single-family home in the Cap-Rouge district, where police conducted a search Monday. His father is listed in the sales deed as an investigator, the Montreal Gazette reported.

Authorities earlier named two suspects, but one of them — a Canadian of Moroccan descent — was later released after it was determined he was only a witness to the bloodbath at the Centre Culturel Islamique de Québec in Ste-Foy.

Bissonnette fled in his Mitsubishi but was caught about 12 miles away near l’île d’Orleans after he called 911, police Inspector Denis Turcotte said. Two rifles and an AK-47 assault rifle were found in the car.

“He was armed and spoke to us about his acts,” Turcotte said, the National Post of Canada reported. “He seemed to want to cooperate….The suspect said he was waiting for the police to arrive.”

Authorities said he “felt bad” and was threatening to kill himself, the French-language newspaper Le Soleil reported.

Witnesses said the gunman shouted “Allahu akbar!” – or “God is great!” – during the rampage, Radio-Canada reported.

Both police and witnesses had initially described two masked men open fire about 7:30 p.m. inside the mosque, where about 50 people were praying. The terrified worshipers fled barefoot in the snow as bullets flew.

The victims — all men — ranged in age from 35 to 60 and were dual nationals, police said. Thirty-nine people were unharmed.

Five people were in critical condition and 14 others suffered minor injuries, according to the Centre Hospitalier Universite Laval, the National Post reported.

“‘It’s a very, very big tragedy for us,” mosque Vice President Mohamed Labidi said. “Security at our mosque was our major, major concern, but we were caught off guard.”

Trudeau said Muslim-Canadians are “an important part of our national fabric.”

“We condemn this terrorist attack on Muslims in a center of worship and refuge,” he said in a statement. “It is heart-wrenching to see such senseless violence.”

Trump called Trudeau Monday to offer his condolences and to offer assistance, the prime minister’s office said.

White House Press Secretary Sean Spicer called the attack “another senseless act of violence that cannot be tolerated.”

“It’s a terrible reminder of why we must remain vigilant, and why the president is taking steps to be proactive, rather than reactive, when it comes to our nation’s safety and security,” Spicer told reporers.

Ali Hamadi said one of his good friends, father-of-three Abdelkrim Hassen, was killed.

“He was my friend, my colleague. We worked together in the civil service for the Quebec government. Had I not left early I could have among the victims,” Hamadi told the Toronto-based Globe and Mail.

“Such a tragic event. How can his children ever come to grasp how their father could have been murdered while praying in a mosque?” Hamadi said.

A witness said the attacker walked in and started spraying bullets at “everything that was moving.”

“It was someone who mastered weapons because it was calm,” the man, who did not give his name, told the paper. “He killed and he killed. It was really horrible.”

He said he lay on his stomach as the man emptied his weapon. Then, he said, the gunman just stopped and left.

Mosque President Mohammed Yangui, who was not inside when the shooting erupted, said he got desperate calls from people at evening prayers.

“A mass shooting. In Quebec City. I can’t believe it,” he told the Globe and Mail. “We’ve never done anything to provoke anyone, and we’ve never cultivated hatred for anyone. I’m just beside myself.”

The mosque has already been the target of hate. In June 2016, a pig’s head was left on the doorstep during the Muslim holy month of Ramadan. Practicing Muslims do not eat pork.

Meanwhile, the New York Police Department said it was stepping up patrols at mosques and other houses of worship.

“NYPD is providing additional protection for mosques in the city. All New Yorkers should be vigilant. If you see something, say something,” Mayor de Blasio said on Twitter.

“Our prayers tonight are with the people of Quebec City as they deal with a terrible attack on a mosque. We must stand together,” Hizzoner said in another tweet.

Hours after the shooting, concerned residents gathered at the Centre sportif de Sainte Foy, where Gazi Hamrouni spent six hours looking for a friend of 20 years.

“He was the first I called when I heard the news,” Hamrouni told The Globe and Mail. “His phone didn’t pick up, now it’s dead and I’ve been to every hospital in the city, several times.”

With Post Wires