Lewis, whose responsibilities include Middle East policy, accused the former Mayor of London of handing Khaled Meshal, the head of the Islamist group, a "propaganda coup" by interviewing him.

In a statement issued by his office, Lewis said: "Ken Livingstone rightly earned praise for his strong and responsible leadership in the aftermath of the 7/7 attacks on London.

It is therefore particularly regrettable that he learned the wrong lessons from history by handing a propaganda coup to the leader of a terrorist organisation.

Hamas has not only breached international law by firing rockets at civilian populations in Israel but continues to violate the human rights of Palestinians in Gaza."

In the interview, Livingstone sought to pre-empt such criticism by arguing that "at the beginning of any peace process, what matters most is engagement."

He recalled that he had been "vilified" in the Eighties for his talks with Sinn Fein leaders Gerry Adams and Martin McGuinness, a policy later adopted by Tony Blair's Labour government.

Livingstone wrote: "No major conflict can be resolved without each side talking to the other. That was the case in South Africa, Ireland and countless other situations where people said they would never talk to their opponents."

He added: "In the Middle East, peace can only be achieved through discussion between the elected representatives of both the Israelis and the Palestinians - and that means Hamas, which won a big majority in the last Palestinian parliamentary election, as well as Fatah."

Lewis is a long-standing supporter of Israel and was formerly the vice-chair of Labour Friends of Israel. He defended the country's widely-criticised military assault on Gaza in January 2009.

Hamas remains a proscribed terrorist organisation in the European Union and the UK government has refused to talk to the group until it renounces violence and formally recognises Israel.

The Commons foreign affairs committee recently urged ministers to begin talks with Hamas and warned that non-engagement appeared to be achieving little.