SAN FRANCISCO — After two years as general counsel at Tesla Motors, Eric Whitaker has stepped down from his post at the electric carmaker.

Whitaker, who resigned earlier this month, said he cut outside legal spending by 70 percent, quadrupled the number of in-house attorneys and helped build the company’s patent portfolio during his tenure.