A former senior attorney at Apple whose job involved ensuring that employees comply with federal insider-trading laws is accused of insider trading in shares of the technology giant.

Federal prosecutors say Gene Levoff, Apple's senior director of corporate law until last year, used advance information about the company's earnings to trade its shares ahead of three quarterly reports in 2015 and 2016. Levoff, 45, allegedly used that information to earn profits of $227,000 and to avoid investment losses of $377,000, according to the U.S. Attorney General's Office for the District of New Jersey.

"Levoff's alleged exploitation of his access to Apple's financial information was particularly egregious given his responsibility for implementing the company's insider trading compliance policy," Antonia Chion, associate director of the Securities and Exchange Commission's enforcement division, said in a statement in a related civil complaint.

Get Breaking News Delivered to Your Inbox

Levoff violated Apple's policies on insider trading, which he helped to revise, to repeatedly make trades based on material, nonpublic information, according to a separate news release from the Department of Justice. Several times, he executed his own illegal trades while telling others not to do so, officials said.

The U.S. attorney in New Jersey also charged Levoff with one count of securities fraud, which carries a possible penalty of 20 years in prison and a $5 million fine.

The San Carlos, California, resident's first scheduled appearance in Newark federal court is Feb. 20.