As he faced the hills and headwinds in the Boston Marathon, Dmytro Molchanov couldn’t stop thinking of friends and family back home in Ukraine.

"When it was really tough, I tried not to give up and tried pushing, kind of fight with myself the way Ukrainians are fighting against Russia right now," he said after crossing the finish line Monday. "It’s really tough, basically, being here while all my family, my friends and Ukrainians are fighting over there for peace in my country, in Europe and the world overall."

A 33-year-old Ukrainian citizen who lives in Brooklyn, Molchanov ran the 26.2-mile race wearing a Ukraine singlet, with his face painted his homeland's yellow and blue. He crossed the finish line with the Ukrainian flag draped over his shoulders.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

While dressed in a Ukraine shirt, a runner holds a Ukraine and American flag while approaching the finish line of the Boston Marathon, Monday, April 18, 2022, in Boston.

While dressed in a Ukraine shirt, a runner holds a Ukraine and American flag while approaching the finish line of the Boston Marathon, Monday, April 18, 2022, in Boston. (AP Photo/Charles Krupa)

More than 40 Ukrainians had registered for the race, but the Russian invasion prevented many from making it to the starting line. Ukraine has barred most men from leaving the country in case they’re needed for military service.

Only a few received special permission to run in Boston.

Molchanov was the fastest among about a dozen Ukrainian citizens in the field, crossing the finish line on Boylston Street in 2 hours, 39 minutes, 20 seconds.

"I still decided to come here and show that Ukrainians are strong, we’re fighting, and we hope peace will come soon," he said.

Race organizers offered refunds or deferrals for Ukrainians who registered for this year’s race. In a stand against the violence in Ukraine, the race also barred athletes from Russia and Belarus who are currently residing in either country.

That made the race even more poignant for Molchanov, whose mother and grandmother have refused to leave their homeland near Crimea.

Along the route, there were signs of support for the Ukraine runners. A man waved a Ukrainian flag, and a large flag was draped over the fencing at the marker for Mile 25.

OLYMPIC CHAMP PERES JEPCHIRCHIR WINS 50TH WOMEN'S BOSTON MARATHON

It wasn't lost on Molchanov that Ukraine's national colors, blue and yellow, are also the race's official colors. Seeing those hues all along the route made it feel like a "home race," he said.

Igor Krytsak also crossed the finish line waving the flag of his native Ukraine. The 33-year-old flew in from Kyiv after getting government permission for three days of travel to participate in the world's oldest marathon.

A runner crosses the finish line of the Boston Marathon, Monday, April 18, 2022, in Boston. 

A runner crosses the finish line of the Boston Marathon, Monday, April 18, 2022, in Boston.  (AP Photo/Charles Krupa)

A humanitarian volunteer in Ukraine, Krytsak saw the race as a chance to shine a light on what his nation has endured. Running in a white shirt with the slogan "Save Ukraine Now," he said he cried several times at the sight of happy families away from the violence of war.

"I thought about those people who are now surrounded, about those who are hiding and fleeing shelling, about those who are now defending our state, and about those who will never wake up and start a new day," he said in messages to The Associated Press.

"I, like millions of Ukrainians, dream that the war will end as soon as possible, and all those involved in those atrocities and crimes must be punished."

Margaux, a State Police K-9, watches as runners pass during the 126th Boston Marathon, Monday, April 18, 2022, in Hopkinton, Mass. 

Margaux, a State Police K-9, watches as runners pass during the 126th Boston Marathon, Monday, April 18, 2022, in Hopkinton, Mass.  (AP Photo/Mary Schwalm)

As the race began Monday, Yaroslav Korolyk followed news coverage from the city of Ivano-Frankivsk in western Ukraine. Korolyk, 31, had qualified for the race but was unable to leave the country. It was the second time his Boston Marathon plans were scuttled, after missing last year’s race because of the COVID-19 pandemic.

Korolyk was frustrated to miss the race, but his anger was overshadowed by the war. In a message to the AP, he said it’s "hard to think about running when another country is bombing your cities and a lot of civilians are dying."

An engineer, Korolyk started running in 2015 and has run eight marathons. He was hoping to run a personal best in Boston this year.

CLICK HERE TO GET THE FOX NEWS APP

"Hope I’ll do it next year," he said.