( On left, murder suspect Oscar Delgado-Perez, 28, before a police manhunt for him. His photo on right was taken after his arrest this week. Source: Montgomery County police photos )

A 28-year-old gang member charged in the brutal stabbing death of a Maryland teenager had been deported twice to El Salvador in the past two years, according to U.S. immigration officials and Montgomery County prosecutors.

Oscar Delgado-Perez was ordered held without bond during his first court appearance Friday in a killing that detectives suspect was over gang bragging rights.

On June 16, Delgado-Perez and at least two other members of the MS-13 gang stabbed Cristian Villagran-Morales, 18, more than 40 times in a park in Gaithersburg as he begged for his life, according to authorities. Delgado-Perez “directed” the attack, detectives wrote in an affidavit filed in court. Police had been searching for him for more than two months and found him Wednesday at a Red Roof Inn in Rockville.

Parked nearby was a car with Texas license plates, belonging to an associate ready to take him from the area, said Robert Hill, a prosecutor with the Montgomery State’s Attorney’s Office.

“He was just about to leave that day for Texas to flee the area. He knew that there was a warrant out for his arrest,” Hill said.

( Cristian Antonio Villagran-Morales, killed in June, was known for his easy smile — at dinner, at his landscaping job and on the beach. Source: Family photos )

After officers apprehended Delgado-Perez, he allegedly told them they’d caught a break. “He said to police: ‘If I hadn’t been drunk this morning, you guys would never have caught me,’ ” Hill said.

Delgado-Perez, charged with first-degree murder, had been living in the Montgomery Village area and working as a roofer to support his 6-year-old child, according to Stephanie Ferner, a public defender who represented him in court Friday.

She questioned the strength of the case against Delgado-Perez, saying it rests on the word of two co-defendants. “Once they were charged, then they pointed the finger at my client,” Ferner said.

At the county jail, according to Friday’s court hearing, officials said they’d found no previous adult convictions for him.

In the case that led to the murder charge against Delgado-Perez, a 19-year-old named Vanesa Alvarado allegedly used the promise of sex to entice Villagran-Morales into Malcolm King Park in Gaithersburg.

Once they arrived, MS-13 members came up to Alvarado and Villagran-Morales and asked him whether he wanted to go into the woods to smoke marijuana, police said. He agreed to do so.

“It was a trap,” Montgomery State’s Attorney John McCarthy said Friday.

( Vanesa Alvarado, 19, has been arrested in the case. Police are still looking for Jose Coreas Ventura, also known as Josue Corea, 20. (Montgomery County police photos.) )

How Delgado-Perez repeatedly entered the United States, and why he was deported twice, remain unclear.

On Sept. 16, 2014, an immigration judge in Batavia, N.Y., ordered him removed from the country, according to spokesman for the Justice Department’s Executive Office for Immigration Review. Delgado-Perez was removed to El Salvador the next month, according U.S. Immigration and Customs Enforcement, also known as ICE.

After entering the United States again, he was removed to El Salvador on Feb. 26, 2015, according to ICE. At some point, he returned.

ICE has placed a hold on him at the Montgomery jail, because he could face a deportation case, too. If he were convicted in Maryland courts in the murder case, he likely would serve his full sentence before being returned home a third time.

While the challenges of illegal immigration are part of the national political debate, they confront local police every day in complicated ways.

The Montgomery County Police Department supports ICE’s efforts to deport violent offenders, said Police Chief Tom Manger. But on the streets, Montgomery officers and detectives also must have the trust of immigrant communities, he said. That means being able to talk with undocumented residents and not ask about their immigration status, he said, so they are willing to report crimes and help solve them.

“We have to strike that right balance,” said Manger. “We’ve got to be able to go into those communities and have trust and cooperation.”

Manger said he understands the anger residents feel when they hear about deported individuals who return and commit violent crimes. “Certainly any community is better off without these individuals,” he said.

In Montgomery County, the challenges are playing out in the context of a rise in homicides linked to MS-13, the violent gang with ties to Central America.

Last year, assailants with links to MS-13 allegedly stabbed and hurled heavy rocks on a victim as he crawled away from an attack toward a stream, according to court records. In another homicide, the victim was told, “Get on your knees,” before being shot in the face, neck and shoulder while in the woods.

In July, police arrested Alvarado and one of the alleged gang members who approached Villagran-Morales at the park: Juan Gutierrez-Vasquez, 16, who was charged as an adult. He told detectives the victim was thought to be a rival gang member, according to court records. But authorities said they found no evidence of that and said the attackers may have made up the claim to gain street credibility.

Gutierrez-Vasquez came to Montgomery County from El Salvador earlier this year, police believe, and joined MS-13 after arriving. “I think he was recruited here,” Detective Dimitry Ruvin has said in an earlier interview.

The victim, Villagran-Morales, was born in Guatemala and arrived in Montgomery this year from New Jersey to live with relatives, police said. He had been doing landscaping work. He sent money home to his father in Guatemala, according to friends.

“Even though there is still tremendous pain in all of our hearts, we feel a bit more calm that justice is being served and that the culprits are being caught,” Jennifer Torres, a girlfriend of one of Villagran-Morales’s cousins, said Friday. “We are still hoping that the other or others will be found.”

Police said they continue to look for suspect Jose Coreas Ventura, 20, who also goes by the name Josue Corea, and should be considered armed and dangerous.

Police officials ask that anyone with information about Ventura or the slaying call 301-279-8000. To be eligible for a reward, tipsters should call 1-866-411-TIPS (8477). Callers may remain anonymous.