April 8 (Reuters) - Tesla has settled a lawsuit over a 2018 car crash that killed an Apple engineer in 2018 after his Model X operating on Autopilot swerved off a highway near San Francisco, court documents showed on Monday.

The settlement was made as the trial was about to start over the high-profile accident involving Tesla's driver assistant technology, ending a five-year legal battle over the case.

The terms of the settlement were not disclosed.

The case involves a highway accident that killed Walter Huang. Tesla had contended Huang misused the Autopilot system because he was playing a video game just before the accident.

Huang's family had alleged Autopilot steered his 2017 Model X into a highway barrier. Lawyers for Huang's family had also raised questions about whether Tesla understood drivers likely would not or could not use the system as directed, and what steps the automaker took to protect them.

Huang's lawyer and Tesla were not immediately available for comment.

The crash that killed Huang was among hundreds of U.S. accidents in which Autopilot was a suspected factor in reports to auto safety regulators.

The Autopilot system can steer, accelerate and brake by itself on the open road but cannot fully replace a human driver, especially in city driving. Tesla materials explaining the system warn that it does not make the car autonomous and requires a "fully attentive driver" who can "take over at any moment." (Reporting by Aditya Soni in Bengaluru and Hyunjoo Jin in San Francisco; Editing by Krishna Chandra Eluri and Lisa Shumaker)