Pierre Chauvin and William M. Welch

USA TODAY

OTTAWA — A Canadian soldier was shot and killed Wednesday while standing guard at a war memorial in the nation's capital in Ottawa, and a gunman was killed after racing inside Parliament.

Canada's Prime Minister, in an evening address to his nation, described the "despicable acts" as terrorism.

"In the days to come, we will learn more about the terrorist and any accomplices he may have had,'' Prime Minister Stephen Harper said.

Authorities said the gunman, later identified as a Canadian, was shot and killed inside the Parliament building by the normally ceremonial sergeant-at-arms of the House of Commons. A barrage of gunfire could be heard inside the building.

Officers searched for any other other shooters, and the sudden attack and ensuing chaos raised fears of coordinated terrorism.

The soldier was gunned down at close range by a man carrying a rifle and dressed in black with a scarf covering part of his face. The man ran to enter Parliament a few hundred yards away. Bystanders fled the scene, and there was more gunfire.

Police identified the dead shooter as Michael Zehaf-Bibeau, a Canadian born in 1982.

Zehaf-Bibeau was described as a recent convert to Islam, Associated Press reported, citing an unnamed government official who spoke on condition of anonymity because the official was not authorized to discuss the case publicly.

The Globe and Mail newspaper of Toronto reported that Zehaf-Bibeau was recently designated a "high-risk traveler" by the Canadian government and that his passport had been seized. It said Zehaf-Bibeau had a criminal record for drug possession, credit-card forgery and robbery.

The slain soldier standing guard was identified by authorities as Cpl. Nathan Cirillo, 24, a reservist from Hamilton, Canada.

Guy Caron, a member of Parliament from Quebec, said he was inside one of the still-locked-down buildings Wednesday night. He was attending a party caucus meeting when they heard theshots.

"It was terrifying, but the swift reaction of Parliament security personnel reassured us," he said. "At first we thought those were construction noises. But then the security guard immediately started locking the doors."

Police lifted a lockdown of much of downtown Ottawa after more than 10 hours, although a security perimeter remained around Parliament buildings.Officials said Parliament would reopen for business Thursday.

Karyne Vienneau, who works on the staff of the deputy leader of the opposition party, said police searched offices Wednesday evening in the Center Block,' or main building, at Parliament Hill.

"I was on the third floor when I heard the gunshots,'' she said. "They resonated throughout the entire building. There was general panic.''

She said staffers dived for cover when they heard the gunshots. "From 10 a.m. until 3 p.m., we were hidden under our desks,'' she said.

Cole Burston, a freelance photographer, said he was outside the gates of Parliament when he heard the shots.

"There was a lot of confusion because shots were coming from two different places,'' he said. "People were standing around, they didn't know about it, and then there are cops running by them with guns."

Ottawa police spokesman Chuck Benoit said two or three gunmen were believed to be involved in the attacks. More than nine hours after the shots were fired, police were still searching, and some buildings remained locked down.

Canada already was on alert because of a deadly hit-and-run this week against two Canadian soldiers.

In Washington, President Obama spoke by phone with Harper and offered U.S. assistance.

"Obviously, the situation there is tragic," Obama said. "Obviously, we're all shaken by it.

"We don't yet have all of the information about what motivated the shooting,'' Obama said. "We don't yet have all of the information about whether this is part of a broader network or plan or whether this was an individual or series of individuals who decided to take these actions.''

Harper, the prime minister, called the acts a "grim reminder" that Canada is not immune to the kind of terrorism that has struck the United States and other countries.

"Together we will remain vigilant against those at home or abroad who wish to harm us,'' he said.

The U.S. Embassy in Ottawa was locked down as a precaution, and security was tightened at the Tomb of the Unknown Soldier at Arlington National Cemetery just outside Washington. The Canadian Embassy in Washington was placed on lockdown as well.

Obama, who recalled being warmly welcomed when he visited the Canadian Parliament, said the United States and Canada are "in sync" when it comes to counterterrorism. "They're our neighbors and our friends," he said.

On Twitter, Member of Parliament Craig Scott credited Parliament sergeant-at-arms Kevin Vickers with shooting the attacker just outside the MPs' caucus rooms.

"Today is a sad and tragic day for our city and our country," Ottawa Mayor Jim Watson said.

Ottawa Hospital received three patients after the shootings, and two were in stable condition. The condition of the third patient was not released.

"Most of downtown Ottawa is in lockdown," Ottawa Police Constable Marc Soucy said.

An eyewitness to the soldier's shooting, Tony Zobl, said he watched it unfold from a fourth-floor window directly above the National War Memorial, a 70-foot, arched granite cenotaph, or tomb, with bronze sculptures commemorating World War I.

"I looked out the window and saw a shooter, a man dressed all in black with a kerchief over his nose and mouth and something over his head as well, holding a rifle and shooting an honor guard in front of the cenotaph point-blank, twice," Zobl told Canadian Press news agency. "The honor guard dropped to the ground, and the shooter kind of raised his arms in triumph, holding the rifle."

White House spokesman Josh Earnest said the nation's thoughts and prayers are with Canada, particularly the family of the slain soldier.

A video taken by a reporter with The Globe and Mail shows police officers responding to the incident in the Parliament building. Officers walk slowly through the building toward its entrance with guns drawn when the sound of a gunshot rings out, followed by the sound of additional shots.

Earlier Wednesday, Tony Clement, a member of parliament, sent out a tweet saying at least 30 shots were fired near a caucus meeting in the Parliament building, prompting the legislators to pile out of the room. "I'm safe with 3 colleagues but we're still at risk," he wrote.

Royal Canadian Mounted Police sent out a tweet about an hour after the first reports of gunfire, warning residents near the downtown core of Ottawa to stay off rooftops and away from windows.

The shooting comes during a tense period for Canada, which has seen its terrorist threat level raised by the government and a military member killed by a man who was under surveillance for possible terrorist ties.

Monday, Martin Couture-Rouleau drove his car into two members of the Canadian military, killing one and injuring the other. Couture-Rouleau — who federal authorities had been investigating after fearing he had become radicalized by jihadist groups — led police on a high-speed chase during which he was shot and killed.

The event followed an announcement Friday by Canada's Ministry of Public Safety and Emergency Preparedness raising the country's domestic terror threat level from low to medium.

The ministry told CP24 news in Toronto that the increased call for vigilance was not in response to a specific threat but tied to "general chatter" from radical Islamist organizations such as the Islamic State, al-Qaeda and others that pose a threat to Canadians.

The concerns over Canada's vulnerability to terrorist threats was the basis for a proposed change in the nation's counterterrorism laws last week. Steven Blaney, Canada's minister of Public Safety and Emergency Preparedness, announced Thursday a bill that would update the country's ability to track and arrest people suspected of terrorism.

In announcing the proposed change to the Canadian Security Intelligence Service Act, Blaney said threats to Canada are "more complex and diffuse."

"Now, more than ever, a radical individual or group can do significant harm to Canada" he wrote.

Contributing: David Jackson in Washington; The Associated Press; Welch reported from Los Angeles