WASHINGTON - Now that tech darling Apple Inc. has been dragged front and center into the debate over the U.S. tax code, lawmakers are hoping that the spotlight on such a high-profile company could be the catalyst for Congress to take action to close loopholes or reform the law.

At a hearing Tuesday, members of the Senate Permanent Subcommittee on Investigations grilled Apple CEO Tim Cook over allegations that the company's Irish subsidiaries help it avoid billions in U.S. taxes. It was a moment of high drama, a CEO of the world's most valuable company testifying before Congress for the first time ever. Cook did so voluntarily. And he parried the volley of questions from senators, insisting that the company's overseas operations have nothing to do with reducing Apple's U.S. taxes.

"We pay all the taxes we owe — every single dollar," Cook said. "We don't depend on tax gimmicks."

The subcommittee released a report Monday that held up Apple as an example of the legal tax avoidance made possible by the U.S. tax code. Apple paid $6 billion in taxes last year. But the subcommittee estimates that Apple avoided at least $3.5 billion in U.S. federal taxes in 2011 and $9 billion in 2012 by using its tax strategy, and described a complex setup involving Irish subsidiaries as being a key factor.

The result, said Sen. John McCain: "Apple has over $100 billion, more than two-thirds of its total profits, stashed away in an offshore account."

The focus on Apple's taxes comes at a time of heated debate in Washington over whether and how to raise revenues to help reduce the federal deficit. Many Democrats complain that the government is missing out on billions of dollars because companies are stashing profits abroad and avoiding taxes. Republicans want to cut the corporate tax rate of 35 percent and ease the tax burden on money that U.S. companies make abroad. They say the move would encourage companies to invest at home and thus spur the economy and job market.

"America's tax system is broken and uncompetitive," said McCain, the subcommittee's senior Republican. "The egregious loopholes that exist in the tax code must be closed so that the nearly $1 trillion in untaxed overseas profits can come back to the United States."

Apple's enormous, iPhone-fueled profits mean that it has more cash stashed overseas than any other company: $102 billion. And Cook reaffirmed Apple's position that it has no intention of bringing that cash back to the U.S. at the current tax rate. Like other companies, it has a responsibility to shareholders to pay as little as possible in taxes. In effect, Apple is holding out for a lower corporate tax rate, and Cook spent some of his time in the spotlight to advocate for one, as well as a streamlining of the tax code to eliminate deductions and credits.

Cook, who is more accustomed to commanding a stage in front of investors and techies than facing a congressional committee, took a defensive tone with his opening statement. He punched out words when stressing the 600,000 jobs that the company supports, and underscored that Apple is the nation's largest corporate taxpayer.

Even if additional tens of billions from Apple began flowing into the U.S. Treasury, the money would barely put a dent in the $642 billion federal budget deficit. But Apple as a symbol resonates with politicians, especially Democrats, seeking to make the case that a powerful corporation shouldn't be excused from its fair share of taxes. The public dissection of Apple hopefully will spur Congress to action to fix the tax code, McCain urged. The sentiment was widely shared among subcommittee members, in a bipartisan show. McCain and Sen. Carl Levin, D-Mich., the panel's chairman, are proposing legislation to do so.

At the same time, lawmakers must tread lightly as they attack Apple, a company held in high esteem and whose ubiquitous products are seen as both innovative and indispensable.

"I love Apple," declared panel member Sen. Claire McCaskill, D-Mo., during the hearing, confiding that she had "converted" her husband to the MacBook. And McCain took a break from grilling Cook on tax questions to ask him, "Why the hell do I have to keep updating the apps on my iPhone all the time?"

Senators on the panel say Apple's situation illustrates their belief that the U.S. tax system is in dire need of repair. The U.S. tax code contains provisions designed to force companies that sell their products overseas to pay U.S. taxes on the profits from those sales. But certain loopholes allow companies to legally bypass those provisions. Sen. Levin contends that Apple's use of such loopholes is unique among multinational corporations.

Apple uses five companies located in Ireland to carry out its tax strategy, according to the Congressional report. The companies are located at the same address in Cork, Ireland, and their boards of directors share members. While all five companies were incorporated in Ireland, only two of them also have tax residency in that country. That means the other three aren't legally required to pay taxes in Ireland because they aren't managed or controlled in that country, in Apple's view.

The report says Apple capitalizes on a difference between U.S. and Irish rules regarding tax residency. In Ireland, a company must be managed and controlled in the country to be a tax resident. Under U.S. law, a company is a tax resident of the country in which it was established. Therefore, the Apple companies aren't tax residents of Ireland or the U.S., since they weren't incorporated in the U.S., in Apple's view.

"Apple is exploiting an absurdity," Levin said. He also called Ireland a "tax haven," an appellation Irish Prime Minister Enda Kenny rejected when speaking in parliament in Dublin on Tuesday.

"We are not a tax haven. American investors quite understand that. Our (taxation system) is statutory-based and clear and transparent and effective right across the board," Kenny said. He also denied the assertion in the subcommittee's report that Apple had negotiated an Irish corporate tax rate of less than 2 percent. All companies pay the standard rate of 12.5 percent on profits from Irish operations, the prime minister said.

Thanks largely to the iPhone, Apple is one of the world's most profitable companies. It earned $41.7 billion in calendar year 2012. It's neck and neck with Exxon Mobil Corp. as the world's most valuable company. However, Apple's Irish subsidiaries date back thirty years, to the time when the Macintosh computer was Apple's banner product, and its profits were a fraction of 1 percent of today's figure. Cook told the panel that those Irish subsidiaries don't reduce the company's U.S. taxes at all. The company avoids paying the 35 percent federal tax rate on profits made overseas by just not bringing those profits back to the U.S., a practice it shares with other multinationals.

Apple has shifted intellectual property rights, like patents, to the Irish subsidiaries, which means other divisions of Apple pay royalties to those subsidiaries for their sales. Those intellectual property rights, like patents, are Apple's "golden goose," Levin said. Apple executives countered that the main U.S.-based company has kept the rights for North and South America, so only royalties for overseas sales flow to the Irish subsidiaries. Also, the Irish companies pay for some of the research and development costs incurred at Apple's headquarters in Cupertino, Calif.

"What Apple is doing is pretty mainstream," said accounting expert Robert Willens, in an interview. Shifting around the intellectual property rights has a minor effect compared to the simple avoidance of U.S. taxes by not repatriating profits, he said.

The subcommittee also has examined the tax strategies of Microsoft Corp., Hewlett-Packard Co. and other multinational companies, finding that they too have avoided billions in U.S. taxes by shifting profits offshore and exploiting weak, ambiguous sections of the tax code. Microsoft has used "aggressive" transactions to shift assets to subsidiaries in Puerto Rico, Ireland and Singapore, in part to avoid taxes. HP has used complex offshore loan transactions worth billions while using the money to run its U.S. operations, according to the panel.

White House spokesman Jay Carney said the issue highlighted by the Senate panel's report, unfairness in the U.S. tax code, is one of longstanding concern to President Barack Obama. Carney said Obama has long favored proposals "to ensure that American companies cannot use off-shore profit shifting to avoid paying taxes," including a proposal for a minimum tax on foreign earnings.

"This has been a major priority of his because he thinks it is inexplicable that our tax code would actually be written in a way that rewards companies for taking jobs and profits offshore, and thereby penalizes companies for doing what we want them to do, which is create jobs and opportunity here in the United States," Carney said Tuesday.

Apple's stock fell $3.27, or less than one percent, to close at $439.66 in Tuesday's trading.

__

Svensson reported from New York. Associated Press writers Shawn Pogatchnik in Dublin and Darlene Superville in Washington contributed to this report.