More than 800 former judges and legal figures have signed a letter to Prime Minister Boris Johnson and Home Secretary Priti Patel, calling on them to apologise for their “hostility” towards the profession.

The letter – which has been signed by three former justices of the UK Supreme Court, three retired High Court judges, more than 80 QCs (senior Queen’s Counsel barristers) as well as hundreds of other lawyers – is in response to “recent attacks, made by the Home Secretary and echoed by the Prime Minister, on lawyers seeking to hold the Government to the law”.

In August, the Home Office was forced to abandon using a video which accuses “activist lawyers” representing migrants of trying to disrupt the asylum system after a barrage of complaints.

Earlier this month, at the Conservative Party’s online conference, Mr Johnson ramped up the rhetoric in the battle between the Government and the justice system with his comments that the Tories were “stopping the whole criminal justice system from being hamstrung by what the Home Secretary would doubtless – and rightly – call the lefty human rights lawyers, and other do-gooders”.

Last week, 28-year-old Cavan Medlock was charged with a terrorist plot to kill a solicitor over his role in representing immigrants.

The letter said: “Such attacks endanger not only the personal safety of lawyers and others working for the justice system, as has recently been vividly seen; they undermine the rule of law, which ministers and lawyers alike are duty-bound to uphold.

“We invite both the Home Secretary and the Prime Minister to behave honourably by apologising for their display of hostility, and to refrain from such attacks in the future.”

Among the signatories to the letter is Lord Dyson, former Master of the Rolls and head of civil justice.

He said: “Governments frequently and rightly emphasise the importance of maintaining the rule of law both here and abroad.

“The rule of law depends on an independent judiciary as well as an independent legal profession, fearless in its representation of those who cannot represent themselves, however unpopular their case may be.

“That is why unwarranted and inflammatory attacks, such as those recently made by the Home Secretary and endorsed by the Prime Minister on lawyers who represent immigrants and asylum-seekers, pose a real threat to the rule of law and are so dangerous.”

Former director of public prosecutions Lord Macdonald, who also backed the letter, said: “The Home Secretary and Prime Minister should recognise that words have consequences.

“Mimicking the language of lawyer-baiting populists is demeaning and dangerous, and a crude attack on the rule of law.”

A Government spokesman told the Guardian “any form of violence is unacceptable”, adding: “Lawyers play an important role in upholding the law and ensuring people have access to justice.

“They are, however, not immune from criticism.”