The United States' largest cargo shipping complex was set to resume full operations after harbor clerks and management settled an eight-day strike that left the ports of Los Angeles and Long Beach mostly idle, sapping the region's economy of an estimated $8 billion.

The striking clerks reached a tentative contract deal with a group of shippers and terminal operators, with prodding from Los Angeles Mayor Antonio Villaraigosa, a onetime labor activist.

Officials for the International Longshore and Warehouse Workers Local 63 said the hundreds of clerical employees who walked off the job Nov. 26, and the thousands of longshoremen who had refused to cross their picket lines, would return to work.

Federal mediators called upon to join negotiations at the mayor's behest showed up at the waterfront community center where talks were being held shortly before the mayor announced the settlement.

"The ILWU voted to approve the contract," Villaraigosa said, standing with smiling members of both negotiating teams.

Union officials said they expected the rank and file, who have been without a contract for more than two years, to ratify the new agreement.

Details of the pact were not immediately made public. But the mayor and ILWU representatives said the two sides had come to terms on the union's chief concern - control over outsourcing, or the transfer of jobs to workers elsewhere for less pay.

What direct role, if any, the mediators played in clinching the deal was unclear. But Villaraigosa said a key breakthrough came when the union, which had resisted outside intervention, joined management on Tuesday morning in consenting to mediation as a way of spurring the stalled talks.

At that point, Villaraigosa told Reuters, "The employers said, 'Why don't we just do this today,'" which led to the final round of negotiations and a deal.

The union earlier credited the mayor with helping the parties narrow their differences during a marathon bargaining session the night before.

Costly Strike

The strike cost Southern California, a region still struggling to recover from a prolonged economic slump, an estimated $1 billion a day, including lost wages and the value of cargo rerouted to other ports, the mayor said.

It marked the worst cargo traffic disruption at Los Angeles and Long Beach - which together account for nearly 40 percent of all U.S. container imports - since a 10-day lockout of longshoremen at several West Coast ports in 2002.

The latest dispute forced a shutdown at 10 of the twin ports' 14 container terminals, as some 10,000 longshoremen and other union workers honored the picket lines of the 800-member ILWU clerical workers unit.

Four other container terminals remained open, along with facilities for handling shipments of automobiles, liquid fuels and break-bulk cargo such as raw steel.

Still, at least 18 freighters bound for Los Angles and Long Beach during the strike changed course to take their cargo to ports in Northern California, Mexico and Panama, according to the non-profit Maritime Exchange of Southern California. T h e diverted cargo heightened concerns about the region losing business to competing ports.

Many other cargo-laden vessels were forced to line up for days at offshore anchorages, waiting to unload their containers.

The chief stumbling block throughout contract negotiations was disagreement over future staffing levels and continued union classification of jobs lost to retirement or other attrition.

Under the agreement, Villaraigosa told Reuters: "The employers are not going to outsource."

Union spokesman Craig Merrilees said: "Really, it was getting control on the outsourcing ... ensuring that the jobs are here today, tomorrow and for the future."

Stephen Berry, chief negotiator for the Harbor Employers Association, representing shippers and terminal operators at the talks, hailed the settlement as "the end of a very long journey. We're delighted with the terms. We'll be operating again and the cargo will be flowing."

During the d