The British author Ian McEwan launched an eloquent attack on Israeli government policies in his speech accepting the Jerusalem prize for literature, saying "a great and self-evident injustice hangs in the air".

Before an audience that included Israel's president, Shimon Peres, culture minister, Limor Livnat, and Jerusalem mayor, Nir Barkat, McEwan spoke of the nihilism on both sides of the conflict.

Addressing his remarks at the opening ceremony of Jerusalem's international book fair to "Israeli and Palestinian citizens of this beautiful city", the novelist said: "Hamas has embraced the nihilism of the suicide bomber, of rockets fired blindly into towns, and the nihilism of the extinctionist policy towards Israel."

But it was also nihilism that fired a rocket at the home of the Gazan doctor, Izzeldin Abuelaish, killing three of his daughters and a niece during the Gazan war. "And it is nihilism to make a long-term prison camp of the Gaza Strip. Nihilism has unleashed a tsunami of concrete across the occupied territories."

The author referred to "continued evictions and relentless purchases of Palestinian homes in East Jerusalem, the process of the right of return granted to Jews but not to Arabs, the so-called facts on the ground of hardening concrete over the future, over future generations of Palestinian and Israeli children who will inherit the conflict and find it even more difficult to resolve than it is today."

He called for an end to settlements and encroachments on Palestinian land.

Despite his stinging criticisms, to which his audience listened in silence, McEwan said he was "deeply, deeply touched to be awarded this honour that recognises writing which promotes the idea of the freedom of the individual in society".

He said that since his decision to come to Israel to accept the prize, "my time has not exactly been peaceful" – referring to demands "with varying degrees of civility" for him to boycott the ceremony.

Jerusalem, he said, was "the most intense place I have ever set foot in".

In the UK, he said, novelists were free to choose how much to write about politics. "Here, for both Israeli and Palestinian novelists, 'the situation' is always there ... It's a creative struggle to address it and a creative struggle to ignore it."

The idea of the freedom of the individual "sits a little awkwardly" with the situation in Jerusalem, McEwan said. He drew comparisons with the UK, saying: "We may have our homeless but we do have our homeland. We are neither threatened by hostile neighbours nor have we been displaced."

He referred to the Shoah, or Holocaust, as "that industrialised cruelty which will remain always the ultimate measure of human depravity, of how far we can fall, and acknowledged "the precious tradition of the democracy of ideas in Israel".

He devoted much of his speech to the nature of the novel which, he said, "has become our best and most sensitive means of exploring the freedom of the individual, and such explorations often depict what happens when that freedom is denied".

He singled out three celebrated Israeli authors – Amos Oz, AB Yehoshua and David Grossman – as "writers who love their country, and made sacrifices for it and have been troubled by the directions it has taken".

They had opposed the settlements, he said, and had become the country's "conscience, memory and above all hope".

In recent years these three writers had felt "the times turning against their hopes", he said.

The question, said McEwan, was Lenin's: what is to be done? Israel, he said, needed to harness the creativity of its writers, artists and scientists, and not "retreat to a bunker mentality".

"The opposite of nihilism is creativity. The mood for change, the hunger for individual freedom that is spreading through the Middle East is an opportunity more than it is a threat."

The prize was presented by Jerusalem's mayor, Nir Barkat, who has enthusiastically backed Jewish settlements in Arab areas of the city. Jerusalem, he said, was "open to everyone to express themselves in a free way". McEwan's writing promoted the "same tolerance as we promote here in Jerusalem," he said.

The author said he was donating his $10,000 (£6,155) prize to Combatants for Peace, an organisation of former Israeli soldiers and former Palestinian fighters.