A circuit court judge in Oregon gave an unusual sentence to a homeless man: Write a 500-word essay about the challenges people face when moving to the United States from another country.

Harold Eugene Denson III’s punishment was for yelling “Go back to your country” and spitting on a Ukrainian immigrant, according to the Multnomah County District Attorney’s Office.

Artem Kutuzov, a car dealership manager who speaks with an accent, approached Denson on Aug. 25 with a trash bag and asked him to clean up his belongings that had spilled into the dealership’s property, according to the Oregonian.

Denson, 37, initially thanked Kutuzov but suddenly became agitated, according to the district attorney’s office.

He yelled that the car dealership didn’t belong to Kutuzov because it was on “American soil.” He also said he was born in the United States, that Kutuzov wasn’t and that Kutuzov should go back to his own country, according to the Oregonian’s review of the affidavit.

Growing more upset, Denson picked up a box cutter with an extended blade and pointed it at Kutuzov, according to state prosecutors. He threatened to cut Kutuzov and spat on him.

Kutuzov was able to get away, and Denson was later arrested and police seized the box cutter from his pocket, according to the district attorney.

Denson pleaded no contest to one count of unlawful use of a weapon and one count of a bias crime in the second degree on Friday — a hate crime under state law, the Oregonian reported.

He also received 90 days of jail time and was credited for time served for the weapon conviction.

Denson has until March to complete his essay. If the court accepts it, his bias crime could be dismissed based on an agreement between the victim and the state that would allow for Denson to withdraw his plea to the crime.

Multnomah County Circuit Judge Christopher Ramras told Denson to “put yourself into their shoes” in his essay that should concentrate on the experiences of Eastern European immigrants who come to the United States, the Oregonian reported.

Multnomah County Deputy District Attorney Nicole Hermann, who prosecuted the case, called the sentence “unusual.”

“Mr. Denson needs to understand the impact his actions had on the victim and our immigrant communities,” she said. “This is an opportunity for him to reconcile his behavior through compassion, learning and understanding.”

Ramras also sentenced Denton to three years of probation under a subdivision specializing in monitoring offenders with mental illness, the paper reported.

Denson thanked the judge for a chance of “reformation” over additional charges on his record, according to the Oregonian.

The paper reported that Denson’s record is marked with convictions for second-degree robbery, first-degree burglary and second-degree kidnapping.

He was released from custody on Monday, according to Multnomah County Sheriff’s Office records.

Read more: