A drug dealer and police informant, testifying in the trial of two San Francisco police officers, said Thursday that Officer Edmond Robles paid him in cash and crystal methamphetamine the first time he turned in a fellow dealer, and told him he could sell narcotics with impunity as long as he kept cooperating.

“He told me, 'You want to sell drugs, you can sell drugs.’ I can do whatever I want, but don’t kill nobody,” Cesar Hernandez told a U.S. District Court jury in the trial of Robles and Sgt. Ian Furminger. The officers, who worked at Mission Station, are charged with stealing drugs and money that was seized from criminal suspects and should have been turned over to the Police Department as evidence.

Hernandez said he started in the drug trade by wrapping bundles of marijuana as an 8-year-old in Mexico and was brought to the United States by a heroin dealer at about age 12. He said he eventually became a middleman in San Francisco’s Mission District, arranging deals between buyers and sellers, after serving time in juvenile hall and state prison. He said Robles and another officer knocked on the door of his cheap hotel room one morning in 2009, barged in, tore his belongings apart and told him he was in trouble unless he started working with them.

After several more such encounters, Hernandez said, he agreed to turn in a former customer of his who had become a competitor. He said he called the man to set up a deal, then led Robles and other officers to his house. Hernandez testified that Robles met him a little while later and “said he was my friend.”

He said the officer pulled out a roll of bills and gave him about $100. Hernandez said he told Robles the deal was worth more, and the officer swore and gave him another $100 to $150, along with a crumpled tissue. He opened it after Robles left, he said, and found a solid piece of crystal methamphetamine, about 2 inches long.

“I thought they were trying to put something on me,” Hernandez said, but he kept the drug and later sold it for between $200 and $400.

He said Robles usually paid him for his information with some of the cash seized from drug dealers. On one occasion, Hernandez said, he led Robles to a major heroin dealer, and the officer told him to buy the drugs on credit and sell them himself. Hernandez said he wasn’t able to sell all of the heroin and gave some of it to Robles, who supplied additional cash to repay the dealer.

Another time, Hernandez said, Robles was short of cash to pay him. When Hernandez, crouching in the back seat of the officer’s car, spotted a known dealer in stolen goods in the Mission, Robles stopped, approached the man, talked to him and returned with an envelope containing $60 or $80 in cash, the witness said.

Robles told him the dealer — a scheduled prosecution witness in the trial — was “a good guy,” Hernandez said.

He said he stopped working with Robles in 2010 after the officer transferred from the narcotics squad to a motorcycle detail. After that, Hernandez said, his contact was Officer Reynaldo Vargas. Vargas, who was indicted along with Robles and Furminger, pleaded guilty to four felony charges last month and has agreed to testify against his former colleagues.

Hernandez said he did not work as an informant for Furminger. But he said Furminger was present at some of the conversations in which Robles and Vargas said they would pay Hernandez a percentage of the cash they seized.

On another occasion, Hernandez said, he complained to Robles about the size of a payment, and the officer replied, “I had to split the money with my boss’’ — an apparent reference to Furminger. The sergeant’s lawyer objected, and U.S. District Judge Charles Breyer told jurors they could consider the statement as evidence against Robles, if they believed he said it. Further evidence was needed to determine whether it could also be considered against Furminger, the judge said.

Furminger and Robles, both longtime officers, have been suspended without pay.

Bob Egelko is a San Francisco Chronicle staff writer. E-mail: begelko@sfchronicle.com. Twitter: @egelko