British diplomats have held talks with members of militant Palestinian group Hamas, Jack Straw has confirmed.
Mr Straw is travelling to the Middle East
Mr Straw said his staff had twice spoken to Hamas members, elected as mayors in the occupied territories.
But he said UK policy was not to talk to the group's leaders as long as they called for the destruction of Israel.
He condemned Tuesday's rocket attack in the Gaza Strip that killed two and wounded six - and hit back at Israeli claims the UK was "aiding extremists".
Speaking in Israel at the start of a Middle East tour, Mr Straw said the rocket attack showed the "wanton, random terror" Hamas was prepared to deploy.
'Route to terrorism'
And he warned Hamas' leadership they would not be involved in any talks until they renounced violence.
On the UK's low-level meetings with Hamas, Shuli Davidovich, spokeswomen at the Israeli Embassy in London, said: "Any dialogue will empower the extremists and not the moderates in the Palestinian Authority.
"As long as Hamas continue to go through the route of terrorism we can't perceive it as a political organisation."
Speaking ahead of his first visit to the region since Mahmoud Abbas was elected Palestinian leader in January, he said Hamas' participation in local elections had presented UK officials with a "dilemma".
"The result of that is that Hamas or people associated with Hamas have been elected in a number of areas," Mr Straw told BBC Radio 4's Today programme.
"We have a diplomatic job to do as others do, and our diplomats in the occupied territories - as anywhere else in the world - see part of their job, indeed part of their job is, to have contact with elected representatives.
"In the occupied territories it is de rigeur, it is required, that if a diplomat of whatever level goes into a town they go and talk to the mayor.
Talks with Abbas
"What happened on two occasions - just two occasions - is that such discussions have taken place.
"But on each of those occasions our staff have spelt out to the elected official - they have been seen in that capacity and that capacity alone - our position overall in respect of no dealings with Hamas as an organisation as long as it continues to support violence and the destruction of Israel."
Ms Straw is meeting Israeli Foreign Secretary Silvan Shalom on Tuesday and will then travel to the Palestinian Authority for talks with Mr Abbas on Wednesday.
The UK foreign secretary will end his trip by meeting Israeli Prime Minister Ariel Sharon. Ms Davidovich would not say whether the contacts with Hamas would be raised during the visit.