HOUSTON -

Two Houston police officers accused of trying to steal and sell 1,000 grams of cocaine appeared in court Thursday.

Officers German Ramos, 36, and Kendrick Ferguson, 33, were relieved of duty pending the outcome of an internal affairs investigation into criminal allegations. The pair worked the evening swing shift out of the Houston Police Department's Northwest Patrol Division and were taken into custody early Wednesday morning.

Houston police said Ferguson and Ramos, along with a civilian, Alex Matos, were charged with possession with intent to deliver a controlled substance over 400 grams.

Investigators said the officers conducted a traffic stop on a vehicle that was being driven by an undercover Houston Police officer. The traffic stop was a a part of a plan put in place by the undercover officer, detectives said. Officials then said Ferguson and Ramos drove to another location.

"The plan was to steal 18 kilos of cocaine from the undercover officer and split the proceeds with the undercover officer at a later date," a prosecutor said in court. "After the undercover officer was secured in the rear of the patrol vehicle, Ramos returned to the undercover vehicle and lifted the rear hatch and got two gym bags from the rear storage area. The undercover officer had advised the civilian that the cocaine would be in the gym bags."

A few minutes later, the SWAT team moved in and arrested both officers.

If convicted, Ramos and Ferguson could face 15 to 99 years in prison and a fine of up to $250,000.

"If these allegations turn out to be true, it clearly angers every person out there wearing the badge who's doing a good job day in and day out and has the integrity to be a Houston police officer," Houston Police Officers Union President Ray Hunt said.

Both officers graduated from the police academy together and joined the force in January 2009.

"We are going to police ourselves and if we have officers who are violating the laws, we are going to prosecute them," Hunt said.