Sir Antony Jay, the co-writer of TV political comedies Yes Minister and Yes, Prime Minister, has died aged 86 after a long illness.

A representative said the former broadcaster died on Sunday evening surrounded by his wife and family.

He penned the 1980s BBC television series, starring Paul Eddington and Sir Nigel Hawthorne, with Jonathan Lynn.

Sir Antony's career began in the BBC's current affairs department where he was a founding member of the Tonight team.

He later scripted the documentaries Royal Family and Elizabeth R: A Year in the Life of the Queen, after which he was appointed Commander of the Royal Victorian Order for personal services to the Royal Family.

Thatcher was 'great fan'

Yes Minister, which ran for three series between 1980 and 1984, followed the travails of MP James Hacker, minister for administrative affairs, and his battles against unflappable Whitehall civil servant Sir Humphrey Appleby.

The subsequent Yes, Prime Minister, broadcast for two seasons between 1986 and 1988, portrayed Hacker's life after he entered 10 Downing Street. Then Prime Minister Margaret Thatcher was known to be a great fan of the series.

Lynn told BBC Radio 4's Today programme he and Sir Antony were "very, very good friends", adding: "Tony was someone I was immensely fond of."

"We didn't really agree about a great many things - he was a right-wing Conservative and I would describe myself as sort-of left leaning."

Image caption Yes, Prime Minister ran for two series between 1986 and 1988

He admitted he first thought Sir Antony's idea to write a comedy about the Civil Service was "dull" and he didn't follow it up for three years, until he was looking for a new project.

Lynn said: "There were no bad memories - except about his illness. We didn't have a cross word in 30-something years. We always got along well - we only had a good time."

Michael Dobbs, who wrote House of Cards, said Sir Antony had helped him when he started out as a writer, adding he was "so generous with his time".

He said Yes Minister was "a programme that could actually engage the attention of Margaret Thatcher", adding: "She never watched television, she didn't have time - yet Yes Minister was one of her extraordinary favourites, and I think it was unique."

Lord Dobbs added Sir Antony and Lynn "really got to the heart of so much of what goes on in Whitehall and Westminster".

'Genius'

The BBC was given permission to shoot exteriors in Downing Street, and Eddington was allowed to walk through the famous door.

Sir Antony and Lynn returned to the comedy in recent years collaborating on a stage version of Yes, Prime Minister in 2010, while writing three general election-inspired sketches aired on BBC's Newsnight in the same year.

Derek Fowlds, who starred as Principal Private Secretary Bernard Woolley in both comedies, said: "We had seven wonderful years together.

"Sir Antony Jay was a genius, quite frankly - I was totally in awe of him. He was very charming, a real true gent. I adored the man."

Image copyright PA Image caption Sir Antony was appointed Commander of the Royal Victorian Order for services to the Royal Family

Earlier this month, the duo reunited again to write a new Yes Minister sketch published in the Guardian newspaper, inspired by the UK's vote to leave the EU.

In his later years, Sir Antony had become an outspoken critic of the BBC, recommending in a 2008 report for the centre-right think tank the Centre for Policy Studies that the corporation be slimmed down to BBC One, Radio 4 and a news department.

He also criticised the BBC for being "biased" on climate change, and suggested staff were "anti-industry" and "anti-monarchy".

Follow us on Twitter @BBCNewsEnts, on Instagram, or if you have a story suggestion email entertainment.news@bbc.co.uk.