The Rev. Michael Waters, pastor of the Joy Tabernacle A.M.E. Church in Dallas, was at the scene as the first shots rang out Thursday evening in downtown Dallas. (Bonnie Jo Mount/The Washington Post)

The minister and the imam had known each other barely a year.

They had met at a vigil after the mass shooting at a Charleston, S.C., church in June 2015. They had encountered each other at rallies to protest gun violence and domestic violence, to memorialize a long-ago lynching, to counter a Ku Klux Klan rally, to remember victims of the Orlando attack.

“We’ve had to come together so many times because of tragedy and heartbreak,” said the Rev. Michael Waters, pastor of the Joy Tabernacle A.M.E. Church.

As the first shots rang out Thursday evening in downtown Dallas, tragedy and heartbreak again brought them together. Waters spotted Imam Omar Suleiman in the crowd near the intersection of Market and Commerce streets, and together they fled what had quickly become a war zone.

The two men, along with Waters’s wife and several parishioners, sprinted to the nearby Omni Hotel. Waters, in a clergy collar and a T-shirt that read “Hope Dealer,” soon flagged down the driver of a Ford Excursion and offered him all of the cash in his wallet to take the group back to his church in South Dallas.

USA Dallas Mayor Mike Rawlings called for a prayer vigil at Thanksgiving Square in downtown Dallas. (Reuters)

Suleiman, a nationally known Muslim scholar and one of two imams at the Valley Ranch Islamic Center, in Irving, piled into the SUV, in which parishioners were sitting on one another’s laps.

[Dallas gunman studied ‘shoot and move’ tactics, black nationalism]

At the Joy Tabernacle, on Holmes Street, the group turned on the news and called their families. Suleiman let his wife and two young children know he was okay. He went into the church’s sanctuary, alone, to say his sunset prayer.

“This wasn’t how I envisioned my first time at your church,” Suleiman told Waters, who weeks earlier spoke at Suleiman’s mosque.

It was about 10:30 p.m. when the small group at the church gathered in a circle inside a multipurpose room. Suleiman stood to Waters’s right, holding his hand. The pastor’s wife stood to his left.

“I remember praying for the protection of people who’d been unable to get away,” Waters recalled. “Praying for the officers that were shot and for their recovery. Praying for the families of the deceased. Praying for our city and for our nation.”

As the night wore on, the church grew quieter. Waters and his wife put their three children — a 9-year-old boy and two girls, ages 6 and 4 — to sleep in the church’s nursery.

About midnight, the two men of faith left the others and went to Waters’s office. Both sighed deeply and sat in silence for 10 seconds, then 20.

“This is going to set us back years,” Suleiman finally said. “This has the potential to delegitimize the cause.”

“We can’t keep going this way,” Waters said. “We can’t just get together in response to violence. We have to be proactive.”

[The victims of the Dallas protest shooting]

How can we get people to channel their frustrations in the right way, the young minister and the young imam wondered aloud. How can we encourage those who follow us to express their fears, to vent their anger, to take action, but to avoid violence at all costs? How can two men of different faiths in Dallas work together to help calm the hatred in the churning and unsettled country?

They talked about how the night began with such hope, how the hours before the shooting were among the most encouraging that either man had known in some time.

“White people, black people, older people, younger people, Jews, Christians, gay, lesbian, straight,” Waters said, recalling the crowd that had gathered Thursday evening. “It was America. It was humanity standing together in one space, saying injustice anywhere is a threat to justice everywhere.”

They talked about how it all unraveled and about the fear that “this turns into a tit-for-tat, a war on the streets of Dallas that we clearly don’t want,” Suleiman said. They agreed they would do everything possible — together — to see that did not happen.

[Obama reaches out to battered nation after rage of ‘demented’ Dallas gunman]

Waters was pondering what he would tell his congregation Sunday. He kept coming back to the Beatitudes, and one verse in particular: “Blessed are the peacemakers, for they shall be called the sons of God.”

Suleiman finally got a ride home from a family member about 1:30 a.m. Friday. Before he left, the two men hugged near the door of the church.

“If we were not brothers before this, we certainly are brothers now,” Suleiman told Waters.

They had long joked about their shared love of basketball and how they might match up on the hardwood, given that both men are taller than 6 feet.

“When are we gonna hit the court?” Waters said.

“We need to do that,” Suleiman said.

“I have to work on my jump shot,” Waters joked. “But give me a couple weeks, and I’ll be ready.”

The next day in downtown Dallas, in front of a massive crowd gathered at Thanks-Giving Square, Suleiman mentioned the evening he spent at Joy Tabernacle. He talked about how he and Waters prayed for peace, how they wrestled with why violence too often precedes unity.

“Is this what it takes for us to come together?” Suleiman asked. “Does it always have to be a tragedy? Does it always have to be murder? Does it always have to be terrorism? Does it always have to be that hatred forces us to love? Does it always have to be that injustice forces us to call for peace? Can we not come together like this in times other than what we saw last night?”

Suleiman also sent a text that day to the man he barely knew a year ago, before one tragedy upon another forged the bond between them.

“My brother, Michael. You’re in my thoughts and prayers,” the imam wrote. “We became family last night. I pray we have decades of working together.”

A reply came quickly.

“You are my brother,” the black minister wrote. “I pray the same.”