Two men seeking to settle a feud with a third suspected drug dealer approached his house in Kensington on Sunday, and one fired a rifle into it, but the man wasn’t home — and the bullets fatally struck his 2-year-old daughter in the head, and injured her mother and a man cleaning the carpets.

» UPDATE: Police sources: 2-year-old killed in Kensington was caught in crossfire of a war between drug dealers

That was the narrative described by Philadelphia law enforcement officials as they prepared to charge the alleged perpetrators with murder and a host of related counts in the fatal shooting on the 3300 block of Water Street.

One of the suspects, Freddie Perez, 30, was arrested Tuesday night in Chester. The second suspect, identified as Tayvon Thomas, 25, was taken into custody on a probation violation warrant on the 3000 block of North Bambrey Street in North Philadelphia.

According to law enforcement sources, Thomas admitted under questioning at the Homicide Unit to being the shooter whose bullet struck and killed Nikolette Rivera. He is expected to be charged with murder and other offenses.

Officials had said they did not believe that Perez fired the shot that killed Nikolette, but suspect that both men had been targeting the girl’s father, Nikolai Rivera, over an unspecified drug dispute.

The shooter “was clearly targeting that house,” acting Police Commissioner Christine M. Coulter said outside Police Headquarters. “The child’s father was not home at the time, but we believe that that’s where the beef was.”

Coulter said Thursday morning, after Thomas was arrested, that the shooter “fired indiscriminately” into the house in the mistaken belief that a man cleaning carpets in there was the intended target. The man, whose name has not been released, was critically wounded.

Perez was ordered held without bail at a hearing early Thursday on dozens of charges, including one count of murder and nine counts of attempted murder.

In the meantime, details offered by law enforcement presented a fuller picture of an incident that shocked city officials and residents, and left lingering sadness on the block where it took place.

» READ MORE: Residents, Philly officials lament weekend violence after 2 children are shot in 24 hours

In addition to the shooting on Water Street, Perez and the other man are both believed to have fired at a passing SUV on the 400 block of Clearfield Street minutes earlier, officials said.

That incident, about a half-mile from the Water Street shooting site, was captured on surveillance video, and ballistics tests showed that the same rifle was used, Coulter said. Tips from the public helped supplement evidence that investigators uncovered, she said.

“We’ve had people giving stuff early on, giving nicknames, giving information, and it restores my faith in saying everyone is outraged when a child is murdered,” Coulter said.

Sunday’s tragic events began around 3:20 p.m., police have said, when Perez and his alleged coconspirator fired shots at the SUV on Clearfield. Perez is believed to have fired a handgun, while the other man allegedly shot a rifle. No one was hit, police have said, and the SUV drove away.

About eight minutes later, police have said, Perez and the other gunman allegedly arrived outside Rivera’s house, which was occupied by women, children, and a contractor cleaning the carpets.

Police believe Thomas fired a rifle six times into the house, apparently targeting Nikolette’s father.

Nikolette was struck once in the head, killing her, and her 24-year-old mother and the 33-year-old contractor were wounded.

Thomas, the alleged shooter, has a long criminal history and has used at least three aliases, authorities say.

A woman who answered the door of the house where Thomas was arrested declined to comment Thursday.

His past record shows seven convictions since he turned 18 for crimes ranging from a Norristown robbery to Philadelphia charges of drug dealing to terroristic threats.

He has been imprisoned repeatedly and was most recently released in September 2018. His most recent case was for a 2016 arrest in Philadelphia on charges of dealing drugs and possessing marijuana. Thomas pleaded guilty to dealing and was sentenced to serve 11 ½ to 23 months in jail. The marijuana charge was dropped.

Perez was taken into custody Tuesday night in Chester. People living on the block where he was arrested said Wednesday morning that they did not know him.

The address listed for Perez in police records is on the 100 block of East Westmoreland Street in Kensington, around the corner from Nikolette’s house.

Perez has a long history of drug-related convictions, most recently receiving a 10-year probationary sentence in 2017 after being found guilty of three drug counts including possession with intent to deliver, according to court records.

Perez also was sentenced to three to six years behind bars in 2011 after pleading guilty to similar counts, records show. And in 2010, he pleaded guilty to several drug-related crimes committed in 2007 and 2009, the records show, earning a five-year probationary sentence.

The details of each case were not immediately available.

Mark H. Bergstrom, executive director of the Pennsylvania Commission on Sentencing, said the 10-year probation given to Perez in 2017 was below the guidelines for someone with his history, but that the courts said the reason was because he was not accused of violence in the case. Bergstrom also said about 20% of similar cases in 2018 ended with sentences that were below the guidelines.

The shooting of Nikolette marked the second time in less than 24 hours that a child was shot in Philadelphia over the weekend. In Hunting Park on Saturday night, an 11-month-old boy was shot four times when someone fired at the car he was in, driven by his stepmother.

On Wednesday afternoon at the house on Water Street, Rosalind Pichardo bent down at a makeshift memorial for Nikolette and tied a handmade sign with a message onto the railing: “THANK YOU For Speaking Up.”

Pichardo, an antiviolence activist, made the sign after hearing the news of an arrest in the shooting. It’s important, she said, for people to recognize how their tips to police can help.

“Finding the shooter of Nikolette has saved a mother, another mother, a phone call,” Pichardo said. “And I really believe that this person … he took the life of Nikolette, he wouldn’t hesitate to take another life. So I really believe that this [sign] is what the people need to hear.”

Staff writers Craig McCoy, Vinny Vella, Joseph A. Gambardello, Ellie Silverman, William Bender, and Anna Orso contributed to this article.