A top Department of Homeland Security official who was accused of fast-tracking visa applications that benefited Democrats is leaving the DHS at the end of the month.

DHS Secretary Jeh Johnson said Wednesday that Deputy Secretary Alejandro Mayorkas will leave on Oct. 28, just a few months short of the end of President Obama's term.

Johnson said Mayorkas was involved in a range of issues, including cybersecurity and immigration.

In 2015, however, Mayorkas was called out by the DHS Office of Inspector General for creating an appearance of "favoritism and special access" on the issue of granting visas.

The OIG concluded that Mayorkas went out of his way to help non-citizens get green cards in cases that helped prominent Democrats.

One of those cases involved getting green cards for a non-citizen investor in a Las Vegas hotel and casino, "at the request of [then] Senate Majority Leader Harry Reid." While DHS staff said this request should not be expedited, Mayorkas "pressured staff" to expedite it.

A second case was related to the foreign investor in an electric car company that had Virginia Gov. Terry McAuliffe as a member of the board. The OIG said Mayorkas' actions "lowered the morale" of DHS officials who were involved.

And the third case related to him getting visas for a company tied to Hillary Clinton's brother Anthony.

Last year, however, Johnson defended Mayorkas as "exceptionally conscientious" and "honest," and said he had "full confidence" in his ability to stay on at DHS.