Alan Sharp, who has died of brain cancer aged 79, once claimed that as a screenwriter he was most interested in "moral ambiguity, mixed motives and irony", all of which are applicable to two of his best movies, the western Ulzana's Raid (1972), directed by Robert Aldrich, and the thriller Night Moves (1975), directed by Arthur Penn. Most of his screenplays were written in the 1970s and reflect the era in which America was suffering the effects of the Vietnam war and post-Watergate paranoia. This goes some way to explaining the bleakness and cynical sense of destiny in Sharp's films, which he called "existential melodramas".

He was born in Alyth, near Dundee. Although the majority of his scripts were set in the US, where he lived for many years, Scotland remained pre-eminent in his character and culture. His script for Rob Roy (1995), a rollicking swashbuckler directed by fellow Scot Michael Caton-Jones, was loosely based on the legend of the 18th-century Scottish folk hero Robert Roy MacGregor, played with gusto by Liam Neeson.

Sharp was somewhat of a swashbuckling type himself. Born to an unmarried mother, he was adopted by a Greenock shipyard worker and his wife, both members of the Salvation Army, when he was a few weeks old. He left school at 14 to work in the shipyards with his adoptive father.

Alan Sharp called his films 'existential melodramas'. Public Domain

After doing his national service, he returned to the shipyards, determined to escape as soon as possible. Already married with two daughters, he went to London with the intention of becoming a writer. It took a few years before he got a couple of scripts accepted by the BBC's teleplay series First Night and The Wednesday Play, and had his first novel published. A Green Tree in Gedde (1965), which featured an incestuous brother and sister, was banned from some public libraries in Scotland despite winning a Scottish Arts Council award. It was followed by another novel, The Wind Shifts (1967).

Sharp married for a second time and also had a relationship with the novelist Beryl Bainbridge, with whom he had a daughter, Ruth. She became the actor Rudi Davies, mostly known for playing Penny Lewis in Grange Hill. "I adored Alan, and I went through hell," Bainbridge said. "He showed up for Rudi's birth, but then went downstairs saying he was going to get a book out of the car and never came back." Sharp also had a son by another partner.

After writing a BBC Play for Today, The Long Distance Piano Player (1970), featuring Ray Davies of the Kinks, he had a feature film screenplay taken up by MGM. But The Last Run (1971), shot in Spain, was not a happy introduction to working on a Hollywood production. Three weeks into shooting, the director, John Huston, quit the picture after arguments with the film's star, George C Scott, over rewrites of Sharp's script, an entire third of which Huston had rewritten. When Huston refused to return to Sharp's original version, the producer, Carter DeHaven, threatened to fire him before he quit voluntarily, being replaced by Richard Fleischer.

Problems aside, the film turned out to be a darkly effective, slightly sententious, chase thriller, with Scott playing a retired gangster, risking a return to crime as a getaway driver, giving one of his best performances, aided by Sharp's edgy dialogue.

Sharp once explained the precepts on which he based his work: "With a screenplay, there's no point spending time describing the characters because you'll have an actor … there's also no point in describing landscapes and places … A screenplay is a blueprint. I am not a visual writer. I write dialogue and don't spend much time envisaging how things should look so I'm very sparing with camera instructions."

After Sharp submitted a strong, laconic script called The Hired Hand (1971) to Peter Fonda as an acting vehicle, Fonda decided to make it his directorial debut. The result was a slow, thoughtful western concerned with an independent woman in a man's world. Many years later, Sharp criticised Fonda's leisurely direction and over-use of stylised visuals.

He had no such reservations about Aldrich's virile direction of Ulzana's Raid, which was the favourite of his films. The strongest element in the script was the relationship between Burt Lancaster and Bruce Davison's characters on their mission to track down a murderous Apache named Ulzana. "Ain't no sense hating the Apaches for killing, lieutenant," says Lancaster. "That would be like hating the desert 'cause there ain't no water on it." Just as The Hired Hand was dubbed "a hippy western", Ulzana's Raid was seen as a revisionist western, with the Apaches standing in allegorically for the Vietcong.

Rather less effective, but likeable, was Billy Two Hats (1974), a British-financed western shot in Israel, directed by Ted Kotcheff. Gregory Peck, attempting a Scottish accent, plays a bank robber who finds himself on the run with Desi Arnaz Jr, to whom Peck says, "You're old enough to be half as stupid."

Night Moves starred Gene Hackman as a private eye on the trail of a missing person that leads him into dark territory. Penn found the right tone for Sharp's spare and bleak script. When Hackman is asked who is winning a football game on television, he replies, "Nobody. One side's just losing slower than the other." Night Moves, though not a box-office success at the time, is now considered one of the best neo-noir movies.

After the poorly received post-apocalyptic adventure Damnation Alley (1977), Sharp spent time on a series of unfilmed scripts and uncredited rewrites (including The Year of Living Dangerously, 1983) before linking up with Sam Peckinpah for The Osterman Weekend (1983), which turned out to be the director's final film. Adapted from Robert Ludlum's bestseller, it was another portentous conspiracy drama suffering from a Nixonian hangover. Tortuous as Sharp's screenplay was, Peckinpah's direction did little to illuminate it. However, in interviews, Peckinpah complained that the movie was re-edited after he had turned it over to 20th Century Fox.

In 1985, Sharp decided to try his hand at directing. Little Treasure, which he also wrote, was a lively adventure story shot in Mexico and starring Margot Kidder as a loud-mouthed stripper and Lancaster (in his third picture with Sharp) as her ailing father.

Sharp then disappeared into the relatively more anonymous ranks of television writers where there is less at stake. But after 10 years away from feature films, he was tempted back to write Rob Roy, an enjoyable epic filmed in Scotland. However, his long-cherished dream of making a film about Robert Burns, with whose "sexual adventures" Sharp identified, remained unfulfilled.

He was to write one further screenplay, Dean Spanley (2008), based on Lord Dunsany's novella set in Edwardian England. The well received comic-drama, directed by Toa Fraser, and starring Peter O'Toole, was partly shot in New Zealand, where the globetrotting Sharp (who had homes in Los Angeles, New Zealand and the Scottish Highlands) was living at the time.

He is survived by Harriet, to whom he was married for more than 30 years, and his six children.