(CNN) -- The U.S. Secretary of Defense says any agreement reached that keeps American troops in Iraq past an end-of-the-year deadline to withdraw must include immunity from Iraqi prosecution.
"If they want the benefits of what we can provide, if they want the assistance, if they want the training, if they want the operational skills that we can provide, then I think they have to understand that they've got to give us some protections in that process," Leon Panetta told sailors Friday during a visit to Naples, Italy, home of the U.S. 6th Fleet.
Panetta's statement follows news this week that Iraq's top political leadership agreed that a number of American troops should remain in the country to aid in training and security, though said it was "unnecessary" to grant U.S. forces legal immunity.
Panetta made the comments while answering a question from a sailor, who inquired about Iraq refusing to grant legal immunity to American forces and what it might mean for the future role of the U.S. military in Iraq.
"This is obviously a very pertinent question right now as we try to deal with the issue of whether or not we'll have a future presence in Iraq," Panetta said, according to a transcript released by the Department of Defense.
The defense secretary said negotiations were ongoing between Iraq's political leadership, U.S. Ambassador James F. Jeffrey and Gen. Lloyd J. Austin III, commander of U.S. forces in Iraq.
Panetta said the meetings include discussions about what are the rights of American troops and what will be required in order for those troops to assist Iraqi forces in the future.
"If you're going to play a large role in dealing with another country where it requires, as I said, a large group of troops to be on the ground and to be dealing with that country, I want to make damn sure that you're protected," Panetta told the sailors.
The U.S. has grown increasingly frustrated with the pace of the negotiations, which have dragged well past an Iraqi self-imposed August deadline to decide whether to keep troops.
The negotiations have been strained following WikiLeaks' release of a diplomatic cable that alleged Iraqi civilians, including children, were killed in a 2006 raid by American troops rather than in an airstrike as initially reported by the U.S. military.
The Pentagon dismissed the cable from U.N. investigator Philip Alston to U.S. officials, saying it had investigated the claims and found there was no merit.
Shortly after the WikiLeaks cable gained attention in news reports in September by McClatchy Newspapers, Iraqi Prime Minister Nuri al-Maliki ordered an investigation into the deaths outside of Tikrit.
U.S. officials have long said they believe Iraq may need help with training, counterterrorism, air defense, command and control and intelligence operations. Any U.S. troops remaining to do those jobs might also need additional security forces.
The prospect of U.S. troops staying beyond the end of the year sits uncomfortably with many Iraqis, who have routinely questioned American motives following the 2003 U.S.-led invasion that toppled Saddam Hussein.
Radical anti-American cleric Muqtada al-Sadr, whose Sadrist political party is closely aligned with al-Maliki, has vowed to escalate armed resistance if the U.S. military does not leave as scheduled, a move that could destabilize the country should his militia repeat the bloody battles it waged against American and Iraqi forces during the height of violence.
Gen. Raymond Odierno, the new Army Chief of Staff, said last month there would be risks in leaving a large force of U.S. troops in Iraq.
A large U.S. force, he said, could provoke new claims of U.S. occupation and distract from efforts to develop the Iraqi military's abilities. He would not comment directly on reports that the White House administration had decided to leave between 3,000 and 5,000 troops, should they be requested by Iraq.
Odierno, who served as the top U.S. commander in Iraq, said training of Iraqi security forces was not complete.
"We need to probably be there to assist them at certain levels for a while," he said last month in a question-and-answer session with journalists at the Pentagon.
Panetta's visit to the Naples base was part of a trip that has taken him to Israel, Egypt and Belgium, where he met with NATO officials.
CNN's Mohammed Tawfeeq contributed to this report.