A Portland police officer shot and killed a man armed with a rifle-style pellet gun at the Union Station Plaza on St. John Street late Saturday morning. It was the third officer-involved shooting of the year in Maine.

Chance David Baker, 22, of Portland was shot on the sidewalk outside the door of the Subway sandwich shop, Assistant Chief Vern Malloch said in a news release Saturday night. Baker was taken by ambulance to Maine Medical Center, where he later died.

The officer, who was not immediately identified, has been placed on administrative leave while the Maine Attorney General’s Office investigates the shooting.

Officers responded to 911 calls around 11:10 a.m. of a man walking through the parking lot, screaming and pointing a gun at cars, Malloch said. At the scene, officers heard conflicting reports that the weapon was a shotgun, rifle or a BB gun.

“They found the man still brandishing the weapon in front of the Subway,” Malloch said. “He was shot on the sidewalk outside the door of the Subway.”

Investigators later determined that the weapon was a rifle-style pellet gun with a wooden stock and a scope.

The Attorney General’s Office has been notified and will conduct an independent investigation as required by state law, Malloch said.

The Portland Police Department is also conducting a separate internal investigation, which will focus on whether the actions of the officer were within department policy, and if any training or policy modifications are necessary.

“The use of deadly force by police is a serious event with potentially tragic consequences,” Malloch said. “The department utilizes multiple levels of review, by several different entities, to ensure we continue to provide the highest level of service and maintain the trust of our citizens. We are saddened by the loss of life and send our condolences to the friends and family of Mr. Baker.”

The officer is not being identified at this time in order to allow him to inform his family members, Malloch said. Being placed on administrative leave is standard procedure in all officer-involved shootings, he said.

People who were at the shopping plaza said a man who appeared intoxicated walked into Coastal Trading & Pawn, bought a BB gun, went outside and started pointing it around the parking lot and toward the sky.

Witnesses who photographed and recorded the incident on their cellphones said said the man dropped the gun to pull up his pants just as police officers arrived. Officers warned him not to pick up the gun, the witnesses said, but he did and an officer shot him in the forehead in front of the Subway and Happy Nails building near the corner of St. John and Congress streets.

The video and photographs the witnesses took showed the man prone on the sidewalk outside the two businesses while a police officer stood next to the body.

Officers cordoned off an area outside the plaza with yellow tape as shoppers stood outside, watching with their shopping bags stacked beside them. Some of them were told by police they would have a two- or three-hour wait until they could remove their vehicles inside the cordoned-off area.

The police tape, which closed off roughly half the parking lot from Congress Street to the shopping plaza’s main entrance on St. John Street, was taken down shortly before 4 p.m. A Portland Fire Department ladder truck was at the plaza – its ladder fully extended – to take aerial photos of the shooting scene.

Earlier, Bonnie West of Gorham watched the entire incident unfold. She said she was inside the Maine Hardware store, where she was shopping for hinges, when someone in the store alerted everyone to what was going on outside.

“You don’t want to go out there,” West said the person warned her.

She said she watched the man waving the gun around outside.

“It looked like a rifle. We just stood and watched,” West said.

Employees at Coastal Trading & Pawn said the man had bought a pellet gun from the shop earlier. They said he did not appear intoxicated. They said they were not aware anything had happened in the parking lot until more than a dozen police cruisers descended on the scene.

Following the completion of the attorney general’s investigation, Malloch said, the police department will create a separate incident review team. It will consist of command staff members and other officers of the Portland Police Department, a member of the Maine State Police, a police chief from an outside agency, the department’s legal adviser, and a community member. The group will make recommendations about whether any policy, training, equipment or procedural changes are necessary for public safety and officer safety, according to Malloch.

The Union Station Plaza, a strip mall, is home to off-price grocery stores, a billiards hall, a laundromat and fast-food restaurants. It sits across the street from the Greyhound Lines bus station and down the hill from Maine Medical Center.

Saturday’s incident was the third police-involved shooting so far this year in Maine, according to the Attorney General’s Office.

On Jan. 22, Jon M. Alspaugh, 57, was killed in a shootout with police investigating a report of domestic violence at his home in Waldoboro.

On Feb. 10 in Vassalboro, Kadhar Bailey, 25, of Gardiner and Ambroshia Fagre, 18, of Oakland were shot and killed by police after Kadhar rammed a Maine State Police cruiser with a pickup truck.

There were six officer-involved shootings in Maine in 2016, two of them fatal. There have been 73 police-involved shootings in Maine since 2007, 36 of them fatal, according to data from the Attorney General’s Office.

The last officer-involved fatal shooting in Portland was on April 25, 2009, when Officers Benjamin Roper and Joshua Wiseman fatally shot David O. Okot, 26, outside an apartment building on Weymouth Street. Attorney General Janet Mills concluded that the officers acted in self-defense in responding to a report of a man displaying a handgun.

An officer-involved shooting in Portland in 2011 and another in 2012 resulted in nonfatal wounds and the Attorney General’s Office concluded that the officers used reasonable deadly force.

A Portland Press Herald investigation in 2012, prompted by five fatal shootings by Maine police in 2011 of people who had mental illness, found that 42 percent of people shot by police between 2000 and 2012, and 58 percent of those who died, had mental health problems.

The Attorney General’s Office, which investigates all police-involved shootings in Maine, had never found one of the shootings to be unjustified, the 2012 investigation found.

Nationally, about half of the 375 to 500 people shot and killed each year by police are mentally ill, the 2012 investigation found.