Jamie Dornan and Dakota Johnson in the film adaptation of the novel Fifty Shades of Grey.
EL James, author of the Fifty Shades of Grey trilogy, has enlisted her husband to write the script for a sequel to February's film, after clashes with the team that turned her bestseller into a box office smash.
Niall Leonard, who has two sons with the novelist, and is himself an author and screenwriter, will pen the follow-up film to Fifty Shades of Grey.
Starring Jamie Dornan and Dakota Johnson as the lovers Christian Grey and Anastasia Steele who bond over their passion for S&M, the film grossed $332m and is the most profitable film of the year.
Leonard, who has written for television dramas including Ballykissangel, Wire in the Blood and Monarch of the Glen, will replace the Bafta-nominated scriptwriter Kelly Marcel, who quit the project.
James threatened to withdraw her endorsement from the film unless her original dialogue from the book was retained. The author rejected a rewrite from the acclaimed playwright Patrick Marber.
Leonard also worked on the script for the first Fifty Shades film but was not credited.
Emboldened by the film's box-office success, James demanded greater control over the script for the sequel, Fifty Shades Darker.
Last month it was reported that James intended to write the screenplay herself, prompting an impasse with the producers Universal over the announcement of the sequel.
A compromise appears to have been reached by handing responsibility to her husband, who is the author of the Crusher thriller book series but who has no previous film credits. The couple have been married for 28 years.
The producer Michael de Luca told The Hollywood Reporter: "Niall is an outstanding writer in his own right, with multiple established credits, and we are lucky to have him join Team Fifty."
James retained full control over her properties as part of the deal she struck when the studio optioned her books, which have sold 100 million copies worldwide.
Like Marcel, the director Sam Taylor-Johnson will not be returning for the sequel. The British photographer and visual artist admitted on-set rows with James over the direction of the film, including the ending.
"We would have proper on-set barneys," Taylor-Johnson said. "It was difficult, I'm not going to lie. We definitely fought - but they were creative fights and we would resolve them." Directing Fifty Shades was "an intense and incredible journey for which I am hugely grateful". The search for a new director is ongoing.
Released in February, the Fifty Shades film was responsible for boosting 2015 box-office admissions to their highest first-quarter levels for three years in the UK.
Johnson and Dornan are said to be negotiating for more money for the sequel, placing work on a follow-up on pause. It is hoped that production will begin in the first quarter of 2016.
Leonard was nominated for a Best Young Adult Novel award for the first novel in the Crusher series in 2012. The plot opens with a dyslexic 17-year-old boy discovering that his divorced stepfather, an unsuccessful screenwriter, has been bludgeoned to death.
Produced on a budget of $27m, Fifty Shades is the most profitable film released this year, defying critics who mocked its depiction of the central couple's erotic encounters.