DALLAS (AP) — Dallas police Chief David Brown announced his retirement Thursday, bringing an end to a tenure marked by police unions that at one time demanded his resignation and by widespread praise for his response to a July sniper attack that killed five officers.

Brown issued a statement saying he will retire Oct. 22 after 33 years with Dallas police. He was not immediately available for additional comment.

“I became a Dallas cop in 1983 because of the crack cocaine epidemic’s impact on my neighborhood,” he said in the statement. “I wanted to be part of the solution. Since that time I have taken great pride in knowing that we have always been part of the solution and helped to make Dallas the world class city it is today.”

Brown’s six years as police chief were tumultuous at times as he clashed with police union leaders and others.

Dallas earlier this year dealt with a surge in violent crime that reversed a decadelong decrease in killings and prompted friction between Brown and rank-and-file officers on how to combat the issue. He sought to reassign hundreds of officers to target high-crime neighborhoods and bulk up staffing on the 4 p.m. to midnight shift, but the plan provoked intense backlash and he backed away from implementing it. At least one police union called for his resignation amid the turmoil.

He’s also drawn criticism from unions for not doing enough to retain many officers who have left for better pay elsewhere.

But arguably his defining moment leading a department of more than 3,600 officers was his steady, measured response to the July 7 fatal shootings of four Dallas officers and one transit officer during a protest march downtown. He drew broad praise from President Barack Obama and others for his leadership during one of the most wrenching times in the department’s history.

Brown emerged as the steady and charismatic face of the Dallas police in the days after the shootings by an Army veteran who was motivated by revenge in the wake of police shootings elsewhere that killed or injured black men.

At a memorial service for the slain Dallas officers, Brown spent part of his time reciting Stevie Wonder’s “I’ll Be Loving You Always” to express his affection for his officers.

His later call for those who were protesting mistreatment of black men to join the police ranks prompted a surge in applications.