PASADENA, Texas (AP) _ A gunman killed a police officer and then held a neighbor hostage for 20 hours before shooting himself to death today, police said. The neighbor was unharmed.

Pasadena Police spokeswoman Roseann Boynton said Marvin Harris was found dead of a gunshot wound in Jean Lina's home after the woman walked out of the house with her arms raised and police moved in.

Mrs. Lina, described as in her 60s, emerged from the home apparently unharmed. Her husband, Herald, was taken to her immediately and minutes later, police escorted about half-dozen other relatives to her.

''I'm very relieved the lady is out. I'm worried about my brother,'' Harris' sister, Janet, told reporters after Mrs. Lina was freed. When informed later that her brother had shot himself, she ran off in tears.

Harris, 40, shot Jeff Ginn, 29, Wednesday afternoon after the patrolman responded to a report that smoke was coming from Harris' house. Harris allegedly raised a high-powered rifle and fired eight or nine shots, witnesses said.

Ginn died at Hermann Hospital with gunshot wounds to the head and chest, police said.

''I heard the boom,'' witness Rick Nichols said. ''I looked to one side, I saw the officer laying there and then he (the gunman) turned the gun on us.''

Nichols said two bullets hit his Houston Lighting & Power Co. truck, but he escaped injury.

Witnesses said that Harris ran to a nearby house after shooting the officer, left that house and ran to a third house on the block, where Jean and Herald Lina were at home.

Lina was released a few hours later because he suffered from heart problems. After a trip to the hospital to ensure his health, he returned to the scene and kept a vigil for his wife throughout the night with several of his children.

Before the standoff ended, authorities cut off the electrical power to the house as temperatures climbed into the 90s. Police also blasted loud music and sirens about every 10 minutes to keep Harris awake as they negotiated with him by telephone.

Capital murder charges were filed against Harris late Wednesday.

Neighbors said Harris had a history of mental problems and had barricaded himself in his home a year earlier after firing shots in the neighborhood. The felony assault charge was later dropped.

Ginn was married and had two daughters, ages 2 and 5. The last time a police officer in the Houston suburb was killed in the line of duty was 1943.