Richard Webb, who portrayed television’s Saturday afternoon hero “Captain Midnight” in the 1950s, shot himself to death while despondent over failing health, authorities said.

Webb, 77, was pronounced dead in his Van Nuys home June 10, coroner’s spokesman Scott Carrier said.

The actor’s wife, Florence, was in another part of the house at the time of the shooting. She released a written statement that said he had suffered a long, debilitating respiratory illness.

“Captain Midnight,” a crimefighting series that ran from 1954 to 1958, garnered legions of young fans with its tales of the adventures of Secret Squadron. Ovaltine sponsored the TV show and the radio show that preceded it.

The story was also transformed into comic books and a movie, and the TV show lived on in reruns as “Jet Jackson, Flying Commando.”

In all, he appeared in more than 60 films, 260 television programs and at least eight stage plays.

Born Sept. 9, 1919, in Bloomington, Ill., Webb began his career on the stage in New York before he moved to Hollywood.

In 1959 he starred in the TV series “U.S. Border Patrol,” as well as making guest appearances on many other TV shows.

Webb is survived by his wife, two daughters, four grandchildren and a great-grandson.