Eddie Guidry, left, of the East Baton Rouge Parish Sheriff’s Office gets a hug from Terri Carney during a prayer vigil in Zachary, La., for the officers killed and wounded by a gunman on Sunday. (Max Becherer/AP)

Gavin Long spent the last weeks of his life on the road, trying to convince anyone who would listen about his strange beliefs and spiritual enlightenment.

He stopped in Dallas, crashing on the couch of a childhood friend’s mother and telling both how a visit to Africa had changed his life and how he “already knew the unknown.”

He stopped in Houston, telling strangers on a sidewalk how he had fasted for two years while abroad — as well as abstained from sex — and how it helped him shed 100 pounds and opened a third eye of wisdom.

Then he stopped in Baton Rouge, meandering through the city and recording a rambling video of himself — until the moment Sunday morning when he calmly and deliberately took aim at local police, killing three officers and wounded three others.

A bullet hole created during Sunday’s ambush of police officers remains in the window of the Fitness Expo in Baton Rouge on Tuesday. (Joshua Lott/Getty Images)

In the wake of his violence, Long has left law enforcement here in grief, a protest movement in disarray and nearly anyone whom he encountered in bewilderment over his erratic words, actions and motivation.

Among those wrestling with that fallout Tuesday was President Obama, who penned an open letter of support to police and then met with senior advisers to come up with “concrete recommendations” to protect them.

While many departments already have bulletproof vests for patrol officers, Obama noted that some places still had shortages. He also talked about bridging the bitter divide between police and those protesting police brutality against black people.

“I strongly believe that there is no contradiction between us protecting our officers . . . and building trust between police officers and departments and the communities that they serve,” he said.

One of Long’s victims, Nicholas Tullier, remained in critical condition Tuesday. A group of fellow officers stood watch Tuesday over a mass of teddy bears, flowers and candles outside Our Lady of the Lake hospital, where authorities said the veteran East Baton Rouge Parish sheriff’s deputy was “fighting for his life.”

Beyond the hospital, the city was grappling with a return to normalcy, although one with continuing vigils and a news conference-turned-unity rally by some 80 community leaders from the advocacy group Together Baton Rouge. They crowded the dais at St. Paul Lutheran Church, clutching signs that read “We refuse to be divided” as a minister declared “all lives matter.”

This image from YouTube shows Gavin Long, 29, the man named as the shooter of three police officers in Baton Rouge, La. (Handout/AFP Photo / YouTube )

Lingering is the uncertainty over Long’s motives and fears about the long-term damage his carnage has caused.

Felix Omoruyi of Dallas may have been among the last people to talk at length with Long, with whom he’d grown up in south Kansas City, Mo. The 29-year-old rapper, who goes by the name “Feva,” said Long showed up from Missouri just hours after Dallas was torn apart July 7 by a lone gunman’s deadly ambush of five police officers.

His arrival was also just three days after a black man, Alton Sterling, was shot dead by officers in Baton Rouge and two days after police killed Philando Castile in a suburb of St. Paul, Minn.

“I really feel like watching the video [of Sterling’s death] probably set him off,” Omoruyi said Tuesday. “That [stuff] pissed him off.”

Looking back, he wonders whether Long may have already begun plotting his final fatal stop in Baton Rouge. “I feel like maybe he came to say bye,” Omoruyi said. “I feel like it was like a spur-of-the-moment plan — but it was planned.”

Omoruyi said Long was one of his closest friends, practically a brother. He described him as having a relatively normal childhood and said the two kept in touch even after Long joined the Marines, attended college and traveled on his own to Africa. He returned a changed person, according to Omoruyi, talking passionately about his African roots, Egyptian religious principles and the different stages of spiritual enlightenment.

In Dallas, Long told Omoruyi he was heading to African American neighborhoods in Houston to continue promoting a book, called “The Cosmo Way,” that he had written about his new beliefs.

Omoruyi’s mother wished him good luck. His response was odd, Omoruyi recalled.

“He said something like, ‘When I have the knowledge, I don’t need luck.’ ”

In his rental car, Long went on to Houston. He happened to stop in a neighborhood on the city’s southeast side, pulling up in front of the home of Norma Brooks, 70, and her son Eric Douglas, 45. Douglas was sitting on the sidewalk with four friends, asking passersby for donations for the homeless.

Long introduced himself as Cosmo Setepenra — a name he had adopted in recent years, according to court records. “He said, ‘I’m on a mission to get my book into the urban community. I’m not charging anything, just giving it away,” Douglas said. “People need to know how to eat right, how to see from their third eye.”

Long again waxed on about Africa, describing his two-year spiritual and physical fast there. “If you detox your body the right way, you get in touch with your third eye and your pineal gland,” Douglas remembers him saying. “Being in the motherland gave me life . . . and that’s why I’m going around the U.S. to give that knowledge to other people.”

“He didn’t seem crazy,” Douglas said. “He seemed so together, like really in touch with himself. He had a beautiful smile. He told me, ‘I know it was ordained by God that I passed through to meet you guys.’ ”

Before leaving, Long popped open his trunk and handed Douglas six copies of his book, telling him to spread the word.

“Next time I heard this brother’s name was the morning of the shooting,” Douglas said. “I jumped straight up, grabbed his books off my floor and looked at his picture on the front. And it was the same one on TV. And I thought, ‘How in the hell did this happen?’ ”

Long’s activities once he got to Louisiana are still largely a mystery. In a video he posted to YouTube on Thursday, he can be seen talking to several young men standing on Ozark Street. He goes to the trunk of his car and reaches into a purple backpack to retrieve copies of his book.

“I’m out, like I said, promoting my book,” he tells them. “Elevating our people. Educating our people, you know. Ain’t nobody gonna give us the knowledge that we need, you know what I mean, to be successful and to succeed. So that’s what I’m out here doing.”

Then, an unidentified man joins him in the passenger seat of his car. Long talks about the plight of dark-skinned African Americans. As a light-skinned African American, he tells his passenger that he understood “how hard y’all got it.”

Long asks his passenger whether he had kids; the man says no. Long says he should keep it that way until he could support himself. And he continues to dole out unsolicited advice, telling the man to smoke less weed, to party less and to sleep with fewer “ho’s.”

After a few minutes, the men arrive at the A&J All Around Service store on Plank Road. On the video, someone inside the store asks Long whether he is in Baton Rouge for a protest.

“No, I just got here man,” Long replies. “I came for my people, you know. I’m not really into the protesting. But I do education. The protesting . . . next month? They’re gonna be gone, bro. What we gonna do after that? We’re gonna have to educate ourselves after that.”

The video ends with Long and his passenger back in the car, heading to some unknown location. Long mentions Sterling by name. “It’s two parts to freedom, bro. Knowing your rights and standing on your rights,” he says, his voice raised in anger. “. . . And if you not standing on your rights, then you have no rights.”

The aftermath of all this weighs heavily on activists in Baton Rouge. Some are questioning how best to move forward.

“We had our momentum on,” said Arthur Reed, an organizer of the group Stop the Killings who filmed the viral video of Sterling’s death. “[The protests] were our cry to the world, and the world was listening.”

Driving around town on Tuesday, Reed commented on the city’s emptiness. Streets that had been full of protesters a week ago were now quiet. There were three new names on everyone’s lips: police officers Montrell Jackson and Matthew Gerald, and East Baton Rouge sheriff’s deputy Brad Garafola.

“Nothing is being talked about about Alton Sterling,” Reed said. “His moment has come and gone, quicker than it would have been.”

Wan reported from Washington. Bill Lodge in Baton Rouge and Julie Tate, Abigail Hauslohner, Mark Berman and Adam Goldman in Washington contributed to this report.