In Washington, Mr. Tower began summoning Mr. McCain for a drink at the end of the day. And when they traveled, Mr. McCain took charge of supplying Mr. Tower’s hotel rooms with Johnnie Walker Black. One night at a hotel in Saudi Arabia, one of many Middle Eastern countries where alcohol is banned, Mr. McCain amused his patron by leaving empty bottles for the authorities to find outside the room of a group of Frenchmen  a prank Mr. Tower later delighted at recounting.

The Texan also influenced Mr. McCain’s approach to politics. Mr. Tower, who as a graduate student in London had studied the prewar British Conservative Party, saw in President Carter shades of Prime Minister Neville Chamberlain’s appeasement, his former aides recalled. As the senior Republican on the Armed Services Committee, Mr. Tower hammered Mr. Carter over the hostages in Iran, support for Taiwan, SALT II and the Soviet invasion in Afghanistan  debates Mr. Tower and other hawks saw as skirmishes in a larger battle over whether America would shrink from confrontation or return to the offensive after Vietnam.

“McCain was a rapt student,” said Mr. Dawson, the former Tower aide. “He followed the debates, and he would take part in them in ways that went way beyond his position as bag-carrier or representative of the Navy.”

Mr. Tower was so close to his protégé that he sometimes raised eyebrows by including Mr. McCain in committee staff meetings that were closed to other military liaisons, Mr. Kiland said. His close ties with Mr. Tower, in turn, helped Mr. McCain earn high marks from his Navy bosses, although with some reservations about his grasp for details.

“Sometimes you had to really explain things to him and put him in a context that he really appreciated,” said former Adm. George Kinnear, Captain McCain’s Pentagon superior. “But he was a hard worker once he bought off on an issue.”

Mr. McCain, with his fame and family, would circumvent the Navy’s chain of command for senators with issues like fighting a base closure, pushing for a new Navy hospital or helping a local contractor, aides said. “McCain had a big Rolodex, we used to say,” recalled Michael Hastings, a former Cohen aide. “He could really deliver for senators on both sides of the aisle.”

Over time, Captain McCain also became a minor political player in his own right, sometimes working against the Navy’s official position under the Carter administration. To agitate for laws boosting military pay, former aides said, Mr. McCain steered senators on a trip to Norfolk, Va., toward Navy seamen collecting food stamps. And when the secretary of the Navy declined to replace a giant aircraft carrier, Mr. McCain collected information inside the Navy for lobbyists pushing to build a new one, eventually helping to override a presidential veto.