A homeless Oregon man who reportedly spat at a Ukrainian immigrant and yelled at him to go back to his country was sentenced to jail time — and asked to write an essay about the challenges people face as they start new lives in the U.S.

Harold Denson III, 37, was near a car dealership in Portland on Aug. 25 when the store's manager, Artem Kutuzov, who has an accent, walked over to him with a garbage bag and asked him to clean up the area, which was part of the dealership's property.

US-BORN MARINE VET WRONGLY HELD BY ICE FOR 3 DAYS TO BE PAID $190,000

Denson thanked Kutuzov, but then yelled at him that it wasn't his property, but "American soil," Oregon Live reported, citing a probable cause affidavit. He told Kutuzov he was born in the U.S., and that Kutuzov wasn't — and told him he should go back to his own country.

Harold Denson III, 37, was asked to write a 500-word essay about the struggles immigrants face when they start a new life in America.

Harold Denson III, 37, was asked to write a 500-word essay about the struggles immigrants face when they start a new life in America. (Multnomah County Sheriff's Office)

The homeless man spit on Kutuzov and followed him with a box cutter, allegedly threatening to cut him, as the manager tried to walk away.

Denson became agitated during the encounter because he thought Kutuzov was condescending, his defense attorney said. She said Denson was collecting cans to deposit at a redemption center for money when the cans fell out after a hole formed in his trash bag.

LUCIA SUAREZ SANG: I'M A PROUD (NEW) AMERICAN — AND THIS HAPPENED WHEN I SAID MY FIRST PLEDGE OF ALLEGIANCE

The 37-year-old was arrested and on Friday pleaded no contest to unlawful use of a weapon and second-degree bias, a hate crime under Oregon law, for targeting Kutuzov based on his national origin.

But in an unusual twist, Multnomah County Circuit Judge Christopher Ramras said she would dismiss the bias charge against Denson if he wrote a 500-word essay about the plight of Eastern European immigrants.

“What I am asking you to do is put yourself into their shoes,” Ramras said, according to the news outlet.

Deputy District Attorney Nicole Hermann said she hopes the report will allow Denson to "better understand many of the struggles and the difficulties that people who come from other countries go through when they move to this country and have lived side by side with people who are sometimes not as friendly or kind as they can be."

CLICK HERE TO GET THE FOX NEWS APP

The judge gave Denson until March to write the essay, and Denson said he appreciates "the opportunity to write a report ... rather than stacking up a charge on my record."

In addition to being asked to write the essay, Denson was sentenced to 90 days in jail with credit for time served. If he doesn't write the report, he could face additional punishment.