The cause was a heart attack, said his wife, the journalist Ann McFerran. He lived in London and in Dungeness, on the south coast of England.

Mr. Wilson was a contemporary of British playwrights like David Hare, David Edgar and Howard Brenton, but his work became less obviously political and often more humorous and bizarre than theirs.

A versatile writer, Mr. Wilson wrote film scripts, novels and musicals, including one in which he collaborated with the singer and songwriter Ray Davies of the Kinks.

But he was most known for his plays, which often had a madcap style combining science with the occult, eschewing naturalism, and sometimes obliterating the boundary between life and death.

In his 1994 play "Darwin's Flood," for example, a dying Charles Darwin faces evidence of creationism and a biblical ark while a Scottish Jesus seduces his wife. Nietzsche and a dominatrix also make appearances.

"The Beast" (1974) depicted the occultist Aleister Crowley as an unrepentant hedonist but not "the wickedest man in the world," as the popular press called him in the early 20th century. (Mr. Wilson also wrote a fictional autobiography of Mr. Crowley, "I, Crowley: Almost the Last Confession of the Beast," published in 1997.)

In "The Soul of the White Ant" (1976), in which Mr. Wilson condemned apartheid, the South African naturalist Eugène Marais rises from the grave to offer atonement to a South African woman who kills her servant after they have an affair.

In a 1983 review in The New York Times of Mr. Wilson's play "Our Lord of Lynchville," Mel Gussow described him as "a satiric fantasist, often creating bizarre and anachronistic worlds that bear a striking resemblance to reality once removed."

Andrew James Wilson was born in Reading, England, on Aug. 2, 1948. (Snoo, which rhymes with blue, was a family nickname.) He studied English and American literature under Malcolm Bradbury at the University of East Anglia, graduating in 1969.

In 1971 the experimental Portable Theater produced his play "Pignight," a jarring look at city slickers taking care of a British pig farm who run afoul of a disturbed German farmworker. His plays were also produced by the Royal Shakespeare Company, the Royal Court Theater and the New York Theater Studio.

Mr. Wilson wrote screenplays for "Shadey" (1985), a comedy about a clairvoyant who wants to have a sex change operation, and "Eichmann" (2007), about the interrogation of Adolf Eichmann.

The musical he wrote with Mr. Davies, "80 Days," based on Jules Verne's "Around the World in 80 Days," had its premiere in San Diego in 1988 under the direction of Des McAnuff.

In addition to his wife, Mr. Wilson is survived by a daughter, Jo Wilson; two sons, Patrick and David; two grandchildren; and a brother, Anthony Wilson.

His play "Reclining Nude With Black Stockings," about the Austrian painter Egon Schiele and his mentor Gustav Klimt, was performed at the Arcola Theater in London three years ago, in 2010.