BUFFALO, N.Y. — U.S. Attorney William Hochul has announced his resignation as western New York’s top federal prosecutor at the end of the month.

Hochul, husband of Democratic Lt. Gov. Kathy Hochul, told reporters Thursday that he plans to return to private practice after nearly 30 years with the U.S. Justice Department.

“The time is right,” Hochul said during news conferences at his offices in Rochester and Buffalo.

President Barack Obama nominated Hochul, then an assistant U.S. attorney in the Buffalo office, in 2009 and he took over in 2010.

He was the lead prosecutor in the high-profile Lackawanna Six case in which a group of local Yemeni-American men were convicted of providing material support to militants for traveling in 2001 to train with al-Qaida.

But Hochul said more recent prosecutions of cases related to the Islamic State group have been even more significant because of the group’s brutality and ability to recruit. His office oversaw the conviction of Rochester pizza shop owner Mufid Elfgeeh, who was sentenced in March to 22 ½ years in prison after he admitted recruiting for the group and pleaded guilty to terrorism related charges.

“This office not only arrested the first ISIL recruiter captured anywhere in the world, we convicted him and we received the longest sentence for any terrorist recruiter of any criminal organization anywhere in the United States,” Hochul said in Buffalo about the extremist group member.

Hochul also was among the first prosecutors to use federal laws against gang members and oversaw the prosecution of 20 members of a Niagara County labor union that used violence to secure work.

He will leave office Oct. 28. First Assistant U.S. Attorney JP Kennedy will take over pending the nomination of a successor either by Obama or the next president. The U.S. Senate will then have to confirm the appointment.