David A. Clarke Jr., the sometimes divisive supporter of President Trump who appeared to flirt with taking a senior role in the Homeland Security Department, has resigned from his position as Milwaukee County sheriff, the county clerk said Thursday.

The clerk, George L. Christenson, said in an interview that his office had received a resignation letter from Mr. Clarke at 3:16 p.m. local time. The resignation was to take effect at the end of the day.

“After almost 40 years serving the great people of Milwaukee County, I have chosen to retire to pursue other opportunities,” Mr. Clarke, who is leaving office with more than a year remaining in his term, said in a statement later Thursday. “I will have news about my next steps in the very near future.”

A vocal proponent of gun rights, Mr. Clarke rose to national attention last summer when he spoke at the Republican National Convention. His hard-line stances on law enforcement and association with the N.R.A. endeared him to the right and often brought him into conflict with the Black Lives Matter movement. He has called the Ferguson demonstrators “vultures on a roadside carcass” and once claimed that the Islamic State and Black Lives Matter activists were forming an alliance to destroy America.