Apple chief executive Tim Cook offered no apologies Tuesday for the way his company keeps tens of billions of dollars in overseas profits virtually free of U.S. taxes, amid sharp questions from lawmakers about the practice.

The hearing on Capitol Hill, the first ever faced by Cook, could have turned acrimonious at several points. But Cook seemed intent on fiercely defending his firm’s record — and shaping Apple’s image as a loyal American company — without appearing combative to lawmakers.

His performance marked a stark departure from the culture of political detachment set by the late founder Steve Jobs, who had little patience for Washington politicians.

“While we have never had a large presence in Washington, we are deeply committed to our country’s welfare,” Cook told members of the Senate’s Permanent Subcommittee on Investigations.

Noting the company’s success, Cook quoted President John F. Kennedy: “To whom much is given, much is required.”

But Senate lawmakers said Apple’s rise should mean greater contributions to government coffers.

Those lawmakers accused Apple of setting up an elaborate system overseas to stash cash and avoid tax payments on at least $74 billion in profits between 2009 and 2012, facts that were uncovered in a Senate investigation on Monday. They added that such schemes give Apple and other large corporations an unfair advantage over small businesses.

Sen. Carl Levin (D-Mich.), chairman of the subcommittee, questioned why Apple set up “ghost” subsidiaries in Ireland with no employees or offices. He called the functions of those affiliates “alchemy,” created just to shield global profits from U.S. tax obligations.

Ranking Republican John McCain (Ariz.) said investigators were surprised by the unique setup of Irish tax shelters, adding that it brings new meaning to Apple’s slogan, “Think different.”

“Isn’t it obvious you aren’t bearing the same tax burden as companies in the U.S.?” McCain asked. Apple had a special arrangement with Irish authorities to pay little to no taxes on profits housed in its subsidiaries. The arrangement “gives significant advantage compared to smaller companies,” McCain added.

Cook didn’t deny many of the allegations in the Senate investigation, but he argued that the company’s actions didn’t mean it was a tax dodger. Apple’s cash pile in Ireland was drawn from income it earned overseas, he said.

That money was taxed in the territories where the sales were made, he said. Interest income generated by that cash pile was taxed at the full U.S. corporate rate of 35 percent.

Most of the companies in the Dow 30 have lower tax expenses over the years.

Cook argued that the problem was not Apple’s practices but an outdated U.S. tax code. “We pay all the taxes we owe, every single dollar. We don’t depend on tax gimmicks,” he said.

Cook said the 35 percent corporate tax rate is too high and should be closer to the “mid-20s.” Separately, he said companies that bring cash back to the United States should have a tax rate closer to “single digits” on those sums.

Cook was atypically formal in his Senate appearance, wearing a suit and blue tie instead of his usual uniform of jeans and black dress shirt. But the Alabama native seemed fully at ease in the ceremonious halls of Congress, smiling and greeting lawmakers during a hearing break. He was largely polite and unemotional. Even amid pointed accusations from lawmakers, Cook said he was happy to be at the hearing to make the case for his company.

At one point, Cook turned to a reporter in the press gallery and poked fun at him for using a PC laptop: “You should get a Mac,” he said, to an eruption of laughter.

Some lawmakers said Apple was being unfairly targeted for practices common among multinational corporations.

Sen. Rand Paul (R-Ky.) said the subcommittee was “bullying” Apple.

“If anyone should be on trial here, it should be Congress,” Paul said. “I frankly think the committee should apologize to Apple. The Congress should be on trial here for creating a byzantine and bizarre tax code.”

Tax experts said Apple’s practices, however unseemly, won’t result in any penalties.

Harvard Business School professor Mihir A. Desai estimates that U.S. companies are holding more than $1 trillion overseas by U.S. companies and won’t bring it home unless the U.S. tax rate is lowered. He has advocated that U.S. companies be absolved from U.S. tax payments on global profits that are already taxed in other nations.

Apple, he said, appears to be taking the reins in the debate.

“What Apple is doing is brave and strategically a good idea,” Desai said. “It’s a new strategy for a company that tends to be very secretive, but it harkens back to an era where companies advocated for good policies that they believed were good for the country, too.”

Sign up today to receive #thecircuit, a daily roundup of the latest tech policy news from Washington and how it is shaping business, entertainment and science.