JERUSALEM — Testifying on Monday before an Israeli commission examining the deadly flotilla raid in late May, Prime MinisterBenjamin Netanyahu insisted that Israel had acted in accordance with international law but appeared to shift at least some of the responsibility for the bloody episode onto the Turkish government and his own defense minister, Ehud Barak.

But in the face of domestic criticism over what was interpreted as an evasion of responsibility, Mr. Netanyahu made a statement a few hours later clarifying that as prime minister, the “overall responsibility” lay with him.

Mr. Netanyahu was the first to testify before the government-appointed commission, which is led by a retired Israeli Supreme Court judge, Jacob Turkel, and includes two foreign observers, Lord David Trimble from Northern Ireland and retired Canadian Brig. Gen. Ken Watkin, both of whom were present on Monday.

The Turkel commission will submit reports for review by an international panelestablished last week by the United Nations secretary general, Ban Ki-moon.

Eight Turks and an American-Turkish youth were killed aboard a Turkish boat, the Mavi Marmara, during violent clashes with Israeli naval commandos who raided the vessel, part of a six-boat flotilla, on May 31. The raid, in international waters, was intended to stop the flotilla from its stated goal of breaching Israel’s naval blockade of Gaza, thePalestinian coastal enclave controlled by the Islamic militant group Hamas.

The raid stirred intense international condemnation of Israel and its blockade of Gaza, and severely damaged Israel’s relationship with Turkey, a once-close regional ally. Turkey had demanded an independent, international inquiry and Mr. Ban said that he hoped the formation of the United Nations panel, with Turkish and Israeli participation, might “impact positively” on the fraught relations between the two.

But Mr. Netanyahu told the Israeli-led commission on Monday that Israel had made great diplomatic efforts to prevent the flotilla from trying to reach Gaza, including contacts with “the highest echelons of the Turkish government.”

“Despite our ongoing diplomatic efforts, ultimately the Turkish government did not prevent the Marmara’s attempt to break the naval blockade,” Mr. Netanyahu said.

He added that all of Israel’s suggestions to re-route the ships’ cargo to the Israeli port of Ashdod, from where it could be transferred overland to Gaza, were “in vain.” “We also did not hear a public message from the Turkish government to cool the heated tempers of the activists onboard,” he said.

“Apparently,” he continued, “the Turkish government did not see that a possible incident between Turkish activists and Israel was against their interests, and certainly not something that justified exerting effective pressure” on the activists from a Turkish Islamic charity, Insani Yardim Vakfi, known by its Turkish initials, I.H.H.

Mr. Netanyahu said he was convinced that the Israeli navy commandos who boarded the Mavi Marmara, which had more than 500 passengers, “displayed rare courage in fulfilling their mission and in defending themselves against a real threat to their lives.”

Videos showed soldiers who rappelled onto the deck from a helicopter being attacked by activists wielding clubs, metal rods and knives. Israel says that the activists had at least one gun on board. But the Israelis and the Turkish activists dispute each other’s version of events, including the question of who opened fire first.

The Turkel commission was mandated by the Israeli cabinet to examine the legality of Israel’s naval blockade of Gaza and whether the raid on the flotilla conformed with the rules of international law. It is also supposed to examine the actions taken by the organizers of the flotilla and its participants, as well as their identities, the government says.

Mr. Netanyahu said the naval blockade had been imposed by the previous Israeli government to prevent the smuggling of weapons into Gaza. He argued that neither the naval blockade nor the restrictions on the movement of goods over the land crossings had created a humanitarian crisis in Gaza, and that there was no hunger or lack of essential items there.

Asked by Brigadier General Watkin about statements by the International Committee of the Red Cross and others characterizing the Gaza closure as collective punishment, and therefore a violation of international law, Mr .Netanyahu said his government had verified that the population’s basic needs were being met.

The Turkel commission was not formed to assign personal responsibility for the events surrounding the flotilla episode, but Israeli analysts saw limits on the commission’s powers already being eroded.

“The government may have gotten something it didn’t want,” Prof. Zeev Segal of the law faculty at Tel Aviv University told Israel Radio on Monday, “a committee that will discuss the relationships in the political echelon, in the military echelon. That’s what will happen in the end.”

Mr. Netanyahu stunned many Israelis by revealing that a discussion between the prime minister and his top ministers, known as the Forum of Seven, on May 26, before Mr. Netanyahu left for a trip abroad, focused mainly on the public relations and diplomatic aspect of the looming flotilla crisis. Mr. Netanyahu said he asked to hold a “brainstorming” session on how to prevent a public relations fiasco. It was unclear how much discussion there was about the details of the military operation, or alternative courses of action.

According to Mr. Netanyahu, “all the ministers” expressed the opinion that despite the expected public relations fallout, it was imperative to enforce the blockade.

He added: “I asked that the confrontation be minimized as much as possible and that a supreme effort be made to avoid harming anyone.” The minister of defense and the chief of staff gave the same order, he said.

Mr. Netanyahu was on the stand Monday for about 75 minutes of public testimony and continued testifying behind closed doors.

During his public remarks , he appeared to be shifting at least some responsibility onto the shoulders of his defense minister and coalition partner, Ehud Barak.

According to Mr. Netanyahu, Mr. Barak, who served as defense minister from mid-2007 under the previous government, was central to the decision to impose the naval blockade on Gaza during Israel’s three-week military offensive in 2008-2009.

And when Mr. Netanyahu left for abroad, after the May 26 meeting, he said he left Mr. Barak in charge of coordinating the flotilla issue. The prime minister said he had wanted there to be “a clear address.”

Mr. Barak is scheduled to testify on Wednesday.

Mr. Netanyahu told the commission after the May 26 meeting

that he was “about to leave for a very important meeting with the President of the United States.”

In fact, on May 27 Mr. Netanyahu was in Paris for a ceremony welcoming Israel into the Organisation for Economic Cooperation and Development. From there he went to Canada. After the flotilla raid, he cut short his trip and returned to Israel, canceling the meeting with President Obama that was scheduled for June 1.

An Israeli military investigation into the flotilla raid was completed a month ago . It concluded that professional mistakes were made, at intelligence and operational levels, but that the killings were justified.