PASADENA, Texas (AP) _ A gunman who killed a police officer and held a hostage for 21 hours before committing suicide had applied to the local police academy earlier this week, a police officer said.

Marvin Harris, 40, was wearing a replica of a sheriff's badge when his body was found by police on Thursday, said Sgt. Roy Johnston.

Harris, who had been charged with shooting at an officer once before, was denied a position with the academy when he applied on Monday, Johnston said.

The standoff began Wednesday after Harris fatally shot Officer Jeff Ginn, 29, when the patrolman responded to a call about smoke coming from Harris' home, authorities said.

Police said Harris was burning marijuana leaves on a barbecue pit.

Neighbor Buddy Jaeger said Ginn shot Harris in the leg, then chased him into Jaeger's yard and fired two more shots into the wounded officer.

After the shooting, Harris jumped a fence and holed up in neighbor Jean Lina's residence, taking her and her husband, Herald, hostage, witnesses said.

Thursday morning, Mrs. Lina, in her 60s, emerged from the house unharmed. Her husband had been released earlier.

Harris was found dead of a gunshot wound to the head.

Jaeger said Harris had ''been talking for a long time that if the police messed with him again, he was going to kill them.''

Hours before committing suicide, Harris told police via telephone, ''Let's go to war. I want to be like Samson.''

In February 1989, Harris shot at Johnston when he responded to a call at Harris' home, Johnston said. Harris was charged in the shooting, but the charges were later dropped.