BOSTON (Reuters) - An Arizona man pleaded guilty on Thursday to threatening to bomb Harvard University and shoot students at its first commencement ceremony for black students in 2017, saying he wanted to “end their pro-black agenda.”

Nicholas Zuckerman, 24, faces a prison sentence of up to 18 months after pleading guilty in federal court in Boston to two criminal counts related to comments he posted on Harvard’s Instagram account in May 2017.

Prosecutors said he made the online comments in response to news reports that the Ivy League school would hold a special commencement ceremony on May 23, 2017, to celebrate the accomplishments of black graduates.

“He made those threats specifically because the targeted audience here was black,” Assistant U.S. Attorney Anne Paruti said in court.

She said he admitted making the comments in an Federal Bureau of Investigation interview in which he also discussed the “difficulty” of being a Republican after U.S. President Donald Trump’s election.

According to an indictment, Zuckerman wrote in an Instagram post 10 days before the ceremony: “If the blacks only ceremony happens, then I encourage violence and death at it. I’m thinking two automatics with extendo clips.”

That same day, prosecutors said, Zuckerman posted another online comment, which read: “#bombharvard and end their pro-black agenda.”

He was arrested in June. Zuckerman, a white man who prosecutors said made the online threats under the username “russian_goalkeeper94,” told the court that he was receiving psychological treatment.

Zuckerman pleaded guilty to two counts of transmitting a threat to injure another person.

Under a plea deal, subject to the approval of U.S. District Judge Indira Talwani, Zuckerman faces a sentence of 12 to 18 months in prison. Without the plea deal, he could have faced a sentence of as much as 10 years.

Talwani warned Zuckerman, who has been in custody since his arrest, that he should be prepared at his sentencing on May 23 to demonstrate that he will not commit another crime like this.

“I have to worry about if this is going to happen again,” she said.