David Cameron has made a passionate appeal to the Israeli parliament for its leaders to recognise the dividend of peace, as he poured praise on the country's values and vowed that Britain would steadfastly oppose any boycott of Israel.

He also denounced Iran as a despotic regime still intent on arming Israel's enemies, adding that he believed he would be fighting the threat posed by extremism all his political life.

But Cameron's differences with Israeli prime minister Binyamin Netanyahu were laid bare as the two leaders clashed over settlements on the West Bank, the wisdom of seeking a peace deal with Iran and the willingness of the Palestinian leadership to reach a compromise.

In his speech to the knesset – only the second ever made by a British prime minister – Cameron laid down few challenges to his audience and made only passing reference to the issue of Israeli illegal settlements on the West Bank, one of the biggest stumbling blocks to an elusive peace deal being sought by the US.

He said: "We back the compromises needed – including the halt to settlement activity and an end to Palestinian incitement too."

Speaking at a joint press conference in the prime minister's residence Netanyahu insisted the criticism of the settlements was built on a lie, but Cameron said they made a two-state solution harder to achieve. The Israeli PM warned Iran was still bent on arming and funding those who wished to destroy Israel, claiming it was developing intercontinental ballistic missiles powerful enough to hit London. Cameron said he "understood the concerns of those who are sceptical of any agreement over Iran's nuclear programme", but said he "had a clear aim in the talks of an exclusively civil Iranian nuclear programme".

The disagreements underscore how even close supporters of Israel such as Cameron cannot avoid the roadblocks that lie ahead in reaching the outline settlement sought by the end of next month by the US secretary of state, John Kerry,

The Israeli prime minister said: "The settlements issue will have to be resolved in peace negotiations. The building of a few houses here or there does not fundamentally change the pattern. That is the fact. You can google. Simple truths are evaded by the spread of simple lies all the time. The larger issue is the whole issue of the settlements is the result of the conflict not its cause".

He also insisted he "had frozen the construction of settlements for a year and it did not get Palestinians into negotiations – they just demanded more freezes". He also claimed he had released prisoners but this too had produced no concessions.

He said: "Palestinians persistently will not commit to recognise the Jewish state and this was the ultimate cause of the conflict. The solution to this conflict must pass through this recognition, and indeed must be accompanied by security arrangements that allow us to defend the peace. We hope for the best but in the Middle East but you have to prepare for the worst".

He insisted he had made speeches offering compromises that President Mahmoud Abbas had yet to make.

Earlier, in a 30 minute address designed to reassure the Israelis of his personal commitment to their security, Cameron found some Jewish ancestry in his great-great-great-grandfather, promised to defeat any attempt to ban kosher slaughter practices in the UK and claimed to have led the fight against antisemitism. He also recalled his own visit with his children to the Holocaust memorial in Berlin.

In remarks that won him praise, he also repeatedly referred to Israel as "the nation state of the Jewish people". Cameron promised that his belief in Israel was unbreakable and his commitment to Israel's security would always be rock solid.

The firing of more rockets from the Gaza Strip into Israel will also serve to raise Israeli anger at the way in which Iran appears to be arming Hamas fighters. Cameron condemned the attacks as barbaric and indiscriminate.

Kerry has set a deadline of next month to reach a framework agreement on a two-state solution, but there is no clear sign that he is on the verge of a breakthrough.

Cameron, aware of the delicate state of the talks being overseen by Kerry, deliberately steered clear of lecturing the 120 Israeli MPs on how to conduct the talks.

He said instead: "People come to this parliament from all over the world and talk about how to run your peace process. I will not do that. You know I want peace and a two-state solution. You don't need lectures from me about how to get there."

He asked his audience to imagine "mutual recognition of the nation state of the Palestinian people and the nation state of the Jewish people". His remark stopped narrowly short of the Israeli demand for Israel to be recognised as a Jewish state, a proposal rejected outright by the Palestinians in deference to those Palestinians who would remain in Israel after the creation of two states.

Cameron praised the courageous decisions Netanyahu had taken in releasing political prisoners. But he said he wanted all sides to imagine the possibilities of peace, and avoided any warning that the Kerry process may be the last chance for peace, a view expressed by William Hague, the foreign secretary.

There have been suggestions that Israel might find itself isolated and subjected to trade boycotts and disinvestment if it is seen to be responsible for the failure of talks due to reach fruition by next month.

But Cameron said: "To those who do not share my ambition, who want to boycott Israel, I have a clear message. Britain opposes boycotts, whether it's trade unions campaigning for the exclusion of Israelis or universities trying to stifle academic exchange."

He said: "Delegitimising the state of Israel is wrong. It's abhorrent. And together we will defeat it."

However Cameron's no boycott message does not sit easily with recently issued UK government advice highlighting problems and risks associated with doing business with illegal Israeli settlements and related activities in occupied Palestinian territory.

Published on the UK Trade & Investment website, the guidance warns that there are "clear risks related to economic and financial activities in the settlements, and we do not encourage or offer support to such activity". The document urges firms to take legal advice and consider "possible abuses of the rights of individuals" involved in doing business with illegal Israeli settlements.

In the central theme of his speech, Cameron tried to map out a vision of a peaceful, economically thriving Israel living side by side with Palestine. He said the peace dividends would involve "an end to the outrageous lectures on human rights that Israel receives at the United Nations from the likes of Iran and North Korea. An end to the ridiculous situation where last year the United Nations general assembly passed three times as many resolutions on Israel as on Syria, Iran and North Korea put together. No more excuses for the 32 countries in the United Nations who refuse to recognise Israel."

He urged: "Think of the capitals in the Arab world where Israelis could travel, do business, and build a future. Imagine Israel – like any other democratic nation – finally treated fairly and normally by all."

He said Israel would have not "a temporary deal, broken by Hamas firing rockets at you or Iranian proxies smuggling weapons through the Jordan valley. But a proper, lasting peace that allows a strong, moderate Palestinian government to end the fears of a failed state on Israel's border. A deal that means an end of all claims – and an end of all conflict."

He said he also understood Israel's concerns about security, and had realised only relatively recently how narrow and fragile the land of Israel was, and what it must be like to be afraid in your home. He said that vulnerability had been underscored this week with the interception of the Klos C ship.

Cameron also insisted that Israel had not been the cause of the shadow that he said Iran represented, or of extremist Islam. He said: "We are in the middle of a generational struggle against a poisonous ideology which is an extreme distortion of the Islamic faith – and which holds that terror and murder are not only acceptable but necessary. I am convinced we will be fighting Islamic extremism for the rest of my political lifetime."

Cameron is an unabashed supporter of a rapprochement with Iran, so long as the lifting of economic sanctions leads to commitments by Iran not to develop nuclear weapons.

But he told the Knesset: "I share your deep scepticism and great concern about Iran. I am not starry-eyed about the new regime. A nuclear-armed Iran is a threat to the whole world – not just to Israel; and with Israel and all our allies, Britain will ensure that is never allowed to happen."