A federal judge on Tuesday increased her sentence for a New York City man who planned to join Islamic State and attacked an FBI agent to 25 years on Tuesday, after a federal appeals court called the original 17-year sentence "shockingly low."

Fareed Mumuni, 27, pleaded guilty in 2017 to discussing plans to travel overseas to join the militant group also known as ISIS and trying to stab an FBI agent after authorities arrived at his residence in the New York City borough of Staten Island in 2015 to execute a search warrant.

The United States brands Islamic State a foreign terrorist organization.

Federal prosecutors in Brooklyn successfully appealed Mumuni's 2018 sentence, with the Second Circuit Court of Appeals arguing that U.S. District Judge Margo Brodie had improperly second-guessed whether Mumuni truly planned to kill FBI Special Agent Kevin Coughlin, who survived the attack.

Prosecutors on Tuesday asked Brodie to sentence Mumuni to the 85 years recommended by federal guidelines. Anthony Ricco, a lawyer for Mumuni, urged Brodie to reduce the sentence, arguing that Mumuni had rehabilitated himself.

"I got lucky," Coughlin said in the sentencing hearing on Tuesday, as Mumuni, wearing a white skullcap and black face mask, leaned back in his chair.

Brodie called prosecutors' request for her to sentence Mumuni to 85 years "unreasonable," but said she would place greater weight to his attack on Coughlin and increase the sentence.

Mumuni, whose parents, uncle, and two cousins sat in the courtroom's front row, told Coughlin he was sorry.

"I can't apologize enough for what I've done," said Mumuni, the son of immigrants from Ghana who once interned as a paralegal at the Staten Island District Attorney's office and had been studying to be a social worker and working as a home health aide when he was recruited to ISIS.

"Whatever I say cannot take back what I've done."