The chief of staff to Los Angeles County Sheriff Jim McDonnell stepped down days after it was revealed he forwarded emails containing jokes mocking minorities, Muslims and women when he worked for the police department in Burbank.

McDonnell said in a statement Sunday he accepted Tom Angel's resignation, calling the emails "deeply troubling." The sheriff previously said he had no immediate plans to discipline Angel.

The Los Angeles Times reported last week that Angel sent the emails between 2012 and 2013 when he was second-in-command at the Burbank Police Department. The Times obtained the emails through public records law.

One email joked about black people and Mexicans filling jail cells. Another listed "towels for hats" for why "Muslim terrorists are so quick to commit suicide." It also said, "You can't wash off the smell of donkey."

Angel told the newspaper he was sorry if he offended anyone and never intended for the emails to become public.

McDonnell said he plans to turn the controversy into a learning opportunity for all LASD personnel.

He said he would introduce random audits of department email accounts. He also said he would meet with various community groups to share ideas about deepening the department's understanding and appreciation of the "many ethnicities and religions that are part of the vibrant fabric of the population we serve."

The department also will examine its training and existing policies for "ensuring accountability and enhancing cultural and ethnic sensitivity and professionalism among our personnel," he said.