The Chicago Police Department’s oversight agency has found the fatal shooting of a man on the Northwest Side in 2017 was within department policy.

Brayant Alvarez, 24, was shot to death in the 5000 block of West Wolfram shortly before noon on July 9, 2017.

In its June report, made public Wednesday, the Civilian Office of Police Accountability said the five officers and one sergeant all acted reasonably after Alvarez fired several shots at them.

Earlier in the day, Alvarez’s mother went to the 25th District police station at Grand and Central to tell authorities her son was armed and she feared for her family’s safety.

Alvarez had recently been kicked out of his mother’s home and was staying with his estranged wife and her son in the 2700 block of North LeClaire, according to the COPA report.

His mother told COPA she had previously informed police of her son’s suicidal ideations and his tendency to become aggressive.

Alvarez’s family did not respond to a request for comment.

His mother accompanied police to the home and went inside as officers talked to Alvarez through a window. Within 10 minutes of the officers’ arrival, Alvarez’s wife and son walked out of the home. Alvarez, armed with a chrome handgun, remained inside.

One officer, who had received the CPD’s Crisis Intervention Training, told Alvarez to come out so he could be taken to a hospital for evaluation, but he refused. A supervisor was called to the scene, who soon requested a SWAT team.

A few minutes later, Alvarez came out of the house and fired a shot at one of the officers before running north on LeClaire and east on Diversey, darting through several backyards, according to COPA.

More officers headed to the area, and a responding sergeant saw Alvarez in a backyard in the 5000 block of West Wolfram. He ordered Alvarez to drop the gun, but Alvarez fired a shot at him. The sergeant took cover, and other officers soon found Alvarez hidden in the stairwell in the yard.

After several minutes and repeated orders to drop the gun, Alvarez came out of the stairwell and pointed his gun at police again. Officers in the yard opened fire, fatally wounding him, according to COPA. He tried to run again but collapsed about 10 feet away.

Court records show Alvarez had been arrested on domestic battery charges four months before the shooting. He also pleaded guilty to a 2010 armed robbery and was sentenced to seven years in prison, meaning he could not legally possess a gun.

Alvarez was a truck driver at J&R Dairy in southwest suburban Bridgeview, according to a social media profile. He was a graduate of Clemente High School and had attended Wilbur Wright College.

His estranged wife told detectives he was “talking about committing suicide for a month” before the shooting.

A GoFundMe account was set up by his family to cover funeral expenses.

On the page, Alvarez’s sister wrote: “My brother was a good person and had a good heart. Let’s all remember the Brayant he was. He was a funny, loving, outgoing and caring person, and always there when you needed a helping hand or just someone to hear you out without any judgment. You are never prepared for these types of situations.”

The family of Alvarez declined to comment.