Washington (CNN) White House chief of staff John Kelly expressed some regret about leaving the Department of Homeland Security for his current job, suggesting he was being divinely "punished."

Onstage at a DHS anniversary event Thursday featuring current and former secretaries, Kelly noted his short tenure as secretary -- six months -- and got rousing applause from a department audience that clearly still held him in high esteem when he said he missed "every one" of the employees "every day."

"Truly six months -- the last thing I wanted to do was walk away from one of the greatest honors of my life, being secretary of homeland security, but I did something wrong and God punished me, I guess," Kelly quipped.

Kelly left the job of DHS secretary in July when President Donald Trump tapped him to be his second chief of staff. Kelly's tenure in the White House has been rocky of late , after a series of controversies involving domestic abuse allegations against former aide Rob Porter, disparaging comments Kelly made about immigrants and reports of feuding among the staff.

As he entered the event Thursday, Kelly was upbeat, telling CNN that things at the White House were "pretty good," in his opinion.

Read More