Slideshow ( 2 images )

SAO PAULO (Reuters) - Ford Motor Co said on Tuesday it had reached an agreement with the workers’ union at a historic Brazil plant it plans to shutter by the end of the year, paving the way for a friendly shutdown or potential takeover by a local buyer.

The agreement would allow for Ford’s workers to transition from employment with the U.S. automaker to a potential buyer, if a deal closes. The pact includes an exit package for workers, although the details have not been disclosed, as well as psychological support.

Ford had announced earlier this year it would shut its Sao Bernardo do Campo plant reut.rs/2V72C4q, the company's oldest in the country, and exit the heavy truck business in South America, which is based in that factory.

The decision left the future uncertain for some 3,000 workers and triggered long strikes, paralyzing production for weeks at the sprawling plant. It also prompted the governor of the state of Sao Paulo, where Sao Bernardo is located, to act as a broker to try to find a buyer for the plant that might be able to maintain the jobs.

Local manufacturer CAOA, which already produces cars for China’s Chery and Korea’s Hyundai, has said it is in talks to buy the plant. A representative for CAOA said on Tuesday the company had no further updates on the negotiations.

Ford has also announced layoffs at a separate plant, located in Camaçari in the northeast state of Bahia, where the company has said it has 700 workers in excess of its needs.