A 25-year-old Dallas police officer is being hailed a hero for protecting a photographer who became stranded in Dallas' West End after the first shots were fired Thursday night.

Officer James Dylan Smith's bravery, in Dallas' darkest hours, is captured in a set of photos that has gone viral on social media.

At first, most of the people who saw and shared his photo didn't know his name. Neither did Robert Moore, the photographer and former publisher of the Dallas Voice.

"I don't know his name, but I won't forget him," Moore wrote in his caption for the photos.

They show Smith crouching behind a car with a weapon in his hand. The officer's face is covered in sweat and his brows are raised.

"That photo is not technically perfect. But emotionally, it's there," Moore said.

Smith's family did not respond to The News' request for comment on Saturday.

Ashley Boling, a family friend, said Smith grew up in Rowlett and has been on the Dallas police force for only a few years.

His teenage sister was at Boling's apartment in downtown Dallas at the time of the shooting, unaware that her brother was under fire with his fellow officers, Boling said.

"We just knew that he was going to be OK," Boling said.

By Friday night, Smith had become a social media sensation.

Moore, who was photographing Thursday night's rally, took cover behind cars after the shots rang out about 8:40 p.m.

Officers rushed toward the pops, and Moore wanted to get away.

But police cordoned off the area and weren't letting people in or out. They weren't sure who was shooting or where the shots were coming from.

"Automatic fire, automatic fire," the officers shouted at each other.

They told Moore and other civilians to "get small" and stay down.

A Dallas police officer crouched behind a squad car as shots rang out Thursday night in downtown Dallas. (Smiley N. Pool/Staff Photographer)

The photographer suggested ways he could get to his condo a few blocks away, but Smith urged him to stay put.

"You cannot get into the open, sir," said Smith, holding a gun, his eyes fixed on the street.

Moore, whose brother is the chief of police in Hurst, photographed the officer while he waited for permission to leave.

"I am shoulder to shoulder with somebody who is calm, who is collected," Moore said, referring to Smith. "He's on. He's very much professional."

Moore got the OK to leave after two hours of crouching behind a car. But he didn't have to do it alone.

Smith shielded Moore by standing in front of him, gun still in hand, as they walked about a half block to the edge of the police perimeter.

He put his life on the line to ensure Moore's safety.

"This is a guy in a situation none of us would want to be in, but he signed up to be in it and he's doing it," Moore said.

A Dallas officer took cover behind a police motorcycle during the sniper attack. (Smiley N. Pool/Staff Photographer)

Moore's photographs of Smith are so popular, police departments from all over the country are contacting him to ask whether they can display them in their conference rooms.

"So people can see what other guys have done," Moore said.

Someone recognized Smith in the photos that went viral and shared his name with Moore.

If Moore ever meets Smith again, he knows what he'll tell the officer:

"Chief Brown said Friday that, 'We don't feel much support most days, let's not make today most days.' But I hope that you feel supported.

"I appreciate what you did for me, and I hope everyone else appreciates it."

Photographer Robert Moore was once the publisher of the Dallas Voice. He is now retired and sells his work to galleries. (Ashley Landis/Staff Photographer)

More on the ambush of Dallas police officers

Eight hours of terror: Peaceful protest becomes Dallas police's deadliest day

Profiles in courage: A look at the lives of the 14 Dallas ambush victims

Editorial: This city, our city

How and why Dallas police decided to use a bomb to end the standoff with lone gunman

What we know so far about deadly ambush in downtown Dallas

How to help families of Dallas officers

How Police Chief David Brown's whole life prepared him for the Dallas shooting

Man says wounded DART officer saved his life during ambush

At Dallas police headquarters, the city gathers to memorialize its fallen

Gun-carrying protester mistaken for sniper talks about his hours as most-wanted man in America

You can read our full coverage on this page.