Ranald Graham, who has died of motor neurone disease, aged 69, made his name as a writer of the gritty television crime dramas The Sweeney and The Professionals, which were among the first series to be made entirely on film. In The Sweeney (1975-78), the two Flying Squad officers – Det Insp Jack Regan (John Thaw) and Det Sgt George Carter (Dennis Waterman) – nailed crooks by whatever means they thought necessary. Screeching car chases, punch-ups and hard drinking were par for the course in a programme noted for the violence and bad language perpetrated as much by the law enforcers as the lawbreakers.

With The Sweeney, Graham was in the company of writers of the stature of Troy Kennedy Martin, Allan Prior and Trevor Preston, but he made his own mark. His first script, for the episode Queen's Pawn, was an early demonstration of how Regan would bend the rules to get a result – fabricating evidence, opening private mail and arranging the kidnap of one of the criminals. Another of his scripts featured the programme's highest body count.

When it was decided to make a feature-film spin-off, Sweeney! (1977), Graham was chosen as the screenwriter. "I felt that he had a cinematic understanding that not all television writers had," recalled the producer, Ted Childs. "It needed to have a larger than life quality, which Ranald was able to bring to it."

In The Professionals (1978-82), guns were added to the mix. To the premise of Bodie (Lewis Collins) and Doyle (Martin Shaw) working for the elite CI5 crime-fighting squad, the writer brought stories of an attempted assassination, a siege, drug trafficking and the exploits of Soviet and East German spies.

Graham was born to Scottish parents in Sandokan, North Borneo, where his father was a businessman. In 1942, shortly after Graham's first birthday, the Japanese invaded and interned him, with his parents and elder sister, in a PoW camp in Kuching. Although almost 2,000 died there, the family survived and Australian troops liberated the camp more than three years later.

When his parents eventually returned to Sandokan, Graham was educated at Gordonstoun school in Scotland, then graduated in English from Trinity College Dublin, where he enjoyed acting with the theatre group, before gaining an MA in contemporary literature from Birmingham University.

Graham decided that he wanted to write and had a play about the 1966 Aberfan colliery disaster performed at the Edinburgh festival fringe. A keen sports enthusiast, who for many years ran round Hyde Park daily, in 1968 he became a researcher and writer for the ITV documentary series Sports Arena, presented by Michael Parkinson.

From there, Graham progressed to writing for the big screen. He brought his very individual qualities to Shanks (1974), the final film made by the American B-movie director William Castle. This macabre horror picture was promoted as "a grim fairytale" and starred the mime artist Marcel Marceau in the dual roles of a puppeteer and a wealthy recluse experimenting with reanimating the dead. Film critics were particularly cruel.

But a new career as a writer of crime dramas followed. After the success of The Professionals, Graham wrote episodes of an Australian version, Special Squad (1984-85). Then, he became series consultant, a writer and, eventually, producer on Dempsey and Makepeace (1985-86). He scripted the opening episode, which established the characters of a streetwise cop from Manhattan (Dempsey, played by Michael Brandon) and a hard-centred, plummy British detective (Makepeace, played by Glynis Barber), who teamed up in a crack undercover unit. Critics found the stories implausible. Similar criticism stung Yellowthread Street (1990), a big-budget police series set and filmed in Hong Kong, again produced by Graham, with Ray Lonnen in the starring role of Ch Insp Alex Vale. It was the writer's last TV work.

Graham enjoyed watching boxing, Scottish rugby and English cricket. He was also famed for the annual Burns Night suppers that he organised for more than 30 years, when he was joined by TV industry stalwarts such as Ian Stuttard and Andy Allan (contemporaries of his at Dublin and Birmingham universities respectively), Childs and the director Tom Clegg. Guests flew in from Dublin, Los Angeles or Australia.

Both of Graham's marriages ended in divorce. He had a son with Judy Monahan and two daughters with Carolyn Trayler. His children survive him.

• Ranald Ian Mackenzie Graham, writer and producer, born 3 January 1941; died 29 August 2010