Police spent Thursday searching for the gunman who opened fire during a late-night protest against police misconduct here — a shooting that wounded two officers and brought fear and mistrust back to the streets of this battered St. Louis suburb.

At midday Thursday, heavily armed police descended on a house here as part of the investigation into the shooting. They brought several people in for questioning, according to Sgt. Brian Schellman, a spokesman for the St. Louis County police.

But none of those people were arrested, and by Thursday evening police said they had no one in custody in the case.

The two wounded officers remained in serious condition, but police said their wounds were not life-threatening. One, a 41-year-old officer on the St. Louis County police force, was struck in the shoulder. The other, a 32-year-old on the police force of Webster Groves, Mo., was struck in the cheek; the bullet lodged near his ear.

The officers were shot at the end of a day that, hours earlier, had appeared to herald progress in Ferguson. Police Chief Thomas Jackson, whose force had been castigated by Justice Department investigators for unfairly targeting black residents, had agreed to step down. His departure had been a key demand of the protest movement that sprang up last summer, after a white Ferguson officer shot and killed an unarmed black 18-year-old, Michael Brown.

Social video of the demonstrations outside police headquarters in Ferguson, Mo., captures the scene before and after two officers were shot. (The Washington Post)

But after midnight, somebody opened fire from a hilltop, shooting out of the darkness over a small crowd of demonstrators and into a line of officers outside the Ferguson Police Department. Then the shooter disappeared.

“What happened last night was a pure ambush,” Attorney General Eric H. Holder Jr. said Thursday afternoon in Washington as his department offered local officials its full range of investigative resources. “This was not someone trying to bring healing to Ferguson. This was a damn punk, a punk, who was trying to sow discord.”

If that was the goal, it worked.

On Thursday, the shooting — along with the tense protests that preceded it — appeared to have deepened distrust between police and protesters here, after months of gradually diminishing tensions.

Kevin Ahlbrand, president of the Missouri Fraternal Order of Police, said that the protests late Wednesday were especially confrontational, with a vocal minority of demonstrators shouting abuse and racial epithets at officers.

“I don’t understand it,” said Ahlbrand, who is a sergeant with the St. Louis Metropolitan Police Department. “They got what they have been asking for — for the chief to resign. Why are they angrier now?”

Protest leaders condemned the shooting and worried that it could trigger a more aggressive police crackdown. “Whoever did this last night put us all in danger,” the Rev. Traci Blackmon, a pastor in Ferguson, said in a phone call with reporters.

As police continue to hunt for suspects in the shooting of two police officers at a protest rally in Ferguson, Mo., demonstrators held a candlelight vigil for peace. (Reuters)

Blackmon also voiced a theory — shared by many in the Ferguson demonstrations Thursday — that the shooter may have been someone trying to undermine the protest movement by tainting it with violence.

“I don’t mean that I have anybody, any person or any group, in mind. But it’s just very difficult not to be suspicious,” Blackmon said. She continued: “I’m suspicious that it is a random act that happened to happen last night. And [that] it wasn’t intended to derail us from the path that we’re on right now.”

On Thursday, President Obama tried to soothe tensions via Twitter: “Violence against police is unacceptable. Our prayers are with the officers in MO. Path to justice is one all of us must travel together.” The message was signed “-bo,” which the White House says is an indication it was written by Obama himself. Speaking Thursday night on ABC’s Jimmy Kimmel Live, Obama called for the arrest of the “criminals” responsible for Wednesday night’s shooting.

In the early hours of Thursday evening, a large group of journalists gathered outside the Ferguson police building, but only a handful of protesters showed up with signs. Nearby, a few dozen clergy members held a vigil — meant both to honor the injured officers and to show solidarity with the ongoing protest movement.

“We who believe in freedom cannot rest until it comes,” the clergy members sang before embarking on a march up South Florissant Avenue.

As of 10 p.m. local time, several dozen protesters remained, chanting, “Black lives matter.”

Officers on duty did not wear riot gear. A line of police vehicles was parked in front of them, providing cover from any attempt to repeat Wednesday’s gunfire.

Lt. Gerald Lohr, the commanding officer in charge of policing Thursday’s demonstrations, said that many of his officers feel uneasy, but noted that the peaceful protests have the right to continue.

“Everybody is a little cautious right now because of what happened,” he told reporters. “But I truly believe that most of the protesters out here aren’t advocating violence.”

Earlier in the day, St. Louis County police had said that their officers, along with the Missouri State Highway Patrol, would take charge of security. Ferguson’s city police force had been in command of security at the building since a state of emergency declared by Gov. Jay Nixon (D) expired in December.

The only obvious sign of the hunt for the gunman was the raid on a one-story brick house about a quarter-mile from the shooting scene. A neighbor across the street said that he saw a SWAT team take several people out of the house.

The owner of the home, Iris Turner, said that her granddaughter was one of three people taken into custody. Turner said the girl had attended the protests and came home when she heard gunfire.

“She wasn’t involved in any of this, none of this,” Turner said as camera crews set up outside her home. All three were later released without charges.

The police headquarters had been the scene of regular demonstrations in recent months. But on Wednesday evening, the group that gathered in the parking lot was bigger, and the mood was unusually tense.

“It was a bad atmosphere. You could feel it in the air,” said Rasheen Aldridge, a key protest organizer.

As the evening wore on, police made arrests and advanced with riot shields to push the crowd back. There were also scuffles among the protesters — at one point, one demonstrator struck another, fighting over an accusation that one of them was exploiting the events in Ferguson for financial benefit. Another, larger disturbance broke out a short time later.

As the night deepened, many protesters departed, leaving about 40 stragglers. Among them was Johnetta Elzie, who had stuck around in hopes of securing the release of three people who had been arrested earlier that evening.

Then came the shots. Police said they were fired from a nearby hilltop, where a street runs toward a residential area of Ferguson. The bullets — apparently fired from a handgun — struck officers who were standing in front of the station, about 125 yards from the shooter.

“As I’m turning to look at the police, I see protesters on the ground crawling, trying to get to their cars,” Elzie said. “I saw the police were on the ground, too.”

A minute later, Elzie said, the officers who had been on the ground stood up with their weapons drawn, pointed uphill. She saw one police officer being dragged back through the grass. Her immediate fear, she said, was that the police would respond with force and that she might get caught in the crossfire. But the officers did not shoot back.

Thursday’s shooting opened a new chapter in a bitter debate about American policing, which began with Brown’s killing and the militarized response of local police to Ferguson protesters. Since then, public anger has erupted repeatedly at police violence — over the killing of a 12-year-old in Cleveland and an unarmed man in Madison, Wis., and after a New York police officer was not indicted for the choking death of an unarmed man in Staten Island.

Violence has also been aimed at police in recent months. In September, two police officers in the St. Louis area were fired upon and one of them was hit in the arm; police said the separate incidents did not appear tied to any protests.

Two New York police officers were gunned down in their squad car in December, an episode that garnered international attention and was followed by officers speaking out about feeling targeted and dehumanized.

On Thursday, Brown’s parents — whose loss turned the world’s spotlight on Ferguson — condemned the latest shooting.

“We reject any kind of violence directed toward members of law enforcement,” Brown’s parents said in a statement released through their attorney. “It cannot and will not be tolerated.”

Sandhya Somashekhar, Mark Berman, Sari Horwitz and Justin Moyer in Washington contributed to this report.