The sacked attorney general has warned that any attempt by Eurosceptic Conservatives to get the UK to withdraw from the European court of human rights will make it difficult for Britain to remain in the EU.

In an interview with the Guardian, Dominic Grieve, the MP who has been responsible for providing legal advice to the cabinet for the past four years, cautioned about the political consequences of quitting the Strasbourg court. "If you withdraw from the court, you withdraw from the Council of Europe [and the European convention of human rights]," Grieve said. "It's difficult to see how the UK can be a member of the EU if it's not adherent to the principles set out in the convention."

Grieve was speaking on Tuesday in the aftermath of his own dismissal in the cabinet reshuffle, as well as that of Ken Clarke and Damian Green – three ministers opposed to withdrawal from the ECHR. Senior ministers who survived the reshuffle, led by the home secretary, Theresa May, and the justice secretary Chris Grayling, have backed the idea.

The European Court of Justice in Luxembourg might begin to try and enforce convention rights against states who are no longer signatories to the convention. "It's a recipe for potential collision with the European Court of Justice," he said.

Asked whether his unexpected departure as attorney general was due to his opposition to withdrawing from the Strasbourg court, Grieve said: "I don't have any reason to think it was influenced by that [but] it's possible that's the case."

Faced with similar problems lawyers tend to come up with the same answer, Grieve explained, and in a telling phrase, he added: "So changing the lawyer is not necessarily going to solve the problem."

Resigning from the Council of Europe, which oversees the ECHR in Strasbourg and of which every European state apart from Belarus is a member, would undermine the international rule of law, he added.

"I have always said it's open to government to contemplate policy options which involve withdrawal from the convention if you accept that there will be reputational consequences to the standing of the UK worldwide in relation to its adherence to human rights. There will be countries, that are not signatories to the convention, that will be encouraged by the UK pulling out." It would send a signal to countries that "human rights don't matter".

For the past nine months the Conservative party has been promising a manifesto on its policy on the ECHR.

"It's not clear to me what the prime minister wants to do," Grieve admitted. "The coalition government is committed to the convention."

Both the ECHR and the European Union need reform, Grieve stressed. The Strasbourg court, for example, had got it "badly wrong" in its ruling requiring prisoners to have the right to vote.

But the European convention on human rights, of which the UK was a founding signatory, is in a "very important document" in the tradition of Magna Carta and the Bill of Rights.

It is legal document, Grieve said, which has "improved human rights in ways that most people take for granted."

Throughout his interview at Westminster, MPs of of his own and other parties came up to commiserate with the former attorney general who is widely respected within the legal profession.

On surveillance, Grieve backed the cross-party emergency bill on data storage and said there should be a wider debate.

"There needs to be greater education [about the need for surveillance]. And perhaps also, although I deplore what Snowden did, but perhaps post-Snowden there's a greater opportunity for debate."

The former attorney general, who continued practicing in the courts until 2008, said that he would consider returning to the bar to take on cases. Asked whether cuts to legal aid have gone too far, he replied: "I think it' been recognised by the lord chancellor [Chris Grayling] that there's no more fat in the system. We are going to have to make sure that we have a proper debate that involves looking at the [system] to work out whether can you cut resources without consequences."

Grieve said he would be representing his Beaconsfield constituency's concerns about the impact of the HS2 rail project. He is also keen to combat what he sees as unreasonable fears stirred up by Ukip about the impact of immigration on the UK economy.

"We have to look at levels of migration ," he said. "We are in a world that is quite chaotic. Some people are really frightened about it. Some people are quite despairing. They don't believe our country is capable of providing a good quality of life.

"That feeds into why people voted Ukip and induces a culture of despair. But I think the UK's future is rather bright. I do worry about population growth and the preservation of the green belt space but I don't think these are insurmountable problems."

Looking back on his time in office, Grieve added: "I would like to think that I have followed in the proper tradition of attorneys-general, providing good quality advice to my colleagues in government and have taken on their needs and concerns."

"The office in the past has come under criticism", he said, a reference to the row over legal advice to the cabinet in the runup to the Iraq war. "I hope I have [gone through that experience of advice over Libya] without criticism.

"I'm proud of the fact that the Crown Prosecution Service has come through a period of great change and severe financial stringency and has remained operationally effective. It hasn't collapsed. I have been very lucky in having two directors of public prosecution [Keir Starmer and Alison Saunders] who seemed to me to deliver very good leadership."

One of Grieve's main priorities has been enforcing greater respect among the media for avoiding contempt of court. "I would like to think that my interventions had been helpful. I have had to prosecute some jurors and members of the media, but the feedback I get is that the press has had [clearer guidance] on the measures and how they can operate."

The scheme of appealing unduly lenient sentences was working well, he said. "We are handling these cases responsibly and in a way that improves public confidence."

Remarking that four years and two months as attorney general was not a record - "someone did 20 years in the 16th century" - Grieve said that the tenure of more recent attorneys had not been so long.

During his period in office relationships between barristers and the Ministry of Justice had been difficult, he added. "I hope I have been able to help in trying to resolve some of the difficulties that have arisen. There have been difficult periods but it's been an enormous privilege to do the job."

