"Both parties have accepted the good offices of the secretary general to help resolve this problem (of the captured soldiers)," Mr Annan told a press conference in the Red Sea city of Jeddah after talks with Saudi leaders.
He said he would appoint a secret negotiator to mediate between the two sides.
"I will work with the parties and I will designate someone to work discreetly and quietly with them to find a solution," he said. "I will not even tell you the name of the person ... because I want him to be able to work discreetly."
Mr Annan stressed that "the only (thing) I insisted on is that if I am going to use my good offices, then my mediator should be the only mediator. If others get involved, we will pull out because you would get wires crossed."
The Shiite guerrilla group Hezbollah's capture of the two Israeli soldiers on July 12 sparked a massive Israeli onslaught against Lebanon until a ceasefire under UN Resolution 1701 took effect on August 14.
The release of the soldiers is at the centre of the UN resolution for a permanent ceasefire on the Lebanon-Israel border.
Hezbollah wants to exchange the soldiers for Lebanese prisoners held in Israeli jails. Hezbollah and Israel have been involved in prisoner exchanges in the past.
Lebanon to protest blockade
In other developments, the Lebanese government will protest to the UN Security Council over Israel's blockade of the country and call on it to force Israel to lift the siege.
The government's move came two days after Lebanese legislators began an open-ended sit-in at the parliament building to protest the Israeli blockade of Beirut's airport and the country's seaports.
The blockade began two days after fighting erupted on July 12 between Israeli troops and Hezbollah guerrillas, and Israel has repeatedly rejected UN Secretary-General Kofi Annan's calls for it to be lifted.
Israel says it is not required under the ceasefire resolution to lift its blockade until Lebanese borders and points of entry are secured to prevent weapons shipments to Hezbollah.
It wants a UN peacekeeping force deploying in the south to also take positions on the Lebanese-Syrian border to stop shipments, but the force is not mandated to deploy there.
"The cabinet has decided to file a complaint with the Security Council against Israel for its continued blockade of Lebanon, its violation of international resolutions ... and its insistence to challenge the international will," Information Minister Ghazi Aridi told reporters after a special Cabinet meeting.
Cabinet also urged Security Council member states to condemn Israel and force it to implement Resolution 1701, Mr Aridi said.
Israel distant
In Israel, Prime Minister Ehud Olmert's spokeswoman Miri Eisin reacted swiftly to Mr Annan's announcement to distance Israel from any agreement with Hezbollah on a negotiating process on the Israeli soldiers.
"Israel does not agree on anything together with Hezbollah. Israel sees the
Lebanese government and the UN, within the framework of Resolution 1701, as the only ones responsible for the unconditional release of the kidnapped soldiers," she told news agency AFP.
Israel's official position remains that it will not enter into any negotiations to free the soldiers, Israeli Foreign Ministry spokesman Mark Regev confirmed.
Hezbollah meanwhile gave a cautious response to the UN offer, backing only indirect negotiations to secure a prisoner exchange.
When asked about the announcement, a senior Hezbollah official, Energy Minister Mohammed Fneish, said he was not authorised to comment on any role for Mr Annan, but added:
"We agree to a basic principle which is to conduct a prisoner exchange through indirect negotiations. Who is the channel is a detail."
Mr Annan did not give more details, but his spokesman Ahmad Fawzi told AFP that the secretary general has "always said we must address the issue of all prisoners, but this particular mediation is focused on the abducted soldiers."
The spokesman did not rule out an eventual swap, although he would not go into details.
In Beirut, US civil rights leader Jesse Jackson who has also travelled to Israel and Syria on what he termed a humanitarian mission said Israel "wants physical evidence that its two soldiers are alive.
"It could by video footage, a picture, or a credible third party like the ICRC (International Committee of the Red Cross) for example," he said.
"It will release a lot of tension and ease the other issues like the embargo," he said, referring to Israel's air and sea blockade which has been in force since the onset of the conflict.
Multinational force
Mr Annan, who was speaking at a joint news conference with Saudi Foreign Minister Prince Saud al-Faisal, also said a UN force to help the Lebanese army consolidate the fragile ceasefire and extend its authority throughout south Lebanon should be in place by mid-September.
"I expect that by mid-September we will have about 5,000 international troops on the ground and they will be deployed to the south with the 16,000 Lebanese troops," he said.
"With that credible force on the ground at that time, Israel should be able to withdraw its forces completely" from south Lebanon, Mr Annan added.
In Jerusalem, meanwhile, a senior military source said the Israeli army would have completed its withdrawal from southern Lebanon in 10 days if the UN and Lebanese army deployment went as planned.
Both Mr Annan and Prince Saud called on Israel to lift its ongoing blockade of Lebanon, which the Saudi foreign minister said breached Resolution 1701.
"I have been in direct touch with the Israeli prime minister, as well as the American administration, to press for the lifting of the blockade ... I'm working very hard on that," Mr Annan said.
Mr Annan held talks with Saudi King Abdullah on the latest leg of a Middle East tour largely focused on shoring up the precarious peace in Lebanon.
He arrived in Jeddah on Monday from Qatar after visiting Lebanon, Jordan, Israel, Syria and Iran. Mr Annan was to travel on to Egypt on Tuesday and then to Turkey.
