WASHINGTON — Melvin L. Watt, the director of the Federal Housing Finance Agency, is under investigation for allegedly sexually harassing a female employee, the agency said on Friday.

Mr. Watt is nearing the end of his five-year term running the agency, which oversees the mortgage finance companies Fannie Mae and Freddie Mac.

Mr. Watt, a Democrat who was appointed in 2013 by President Barack Obama, said on Friday that he was the victim of politically motivated leaks and that he broke no laws.

“The selective leaks related to this matter are obviously intended to embarrass or to lead to an unfounded or political conclusion,” Mr. Watt said in a statement. “However, I am confident that the investigation currently in progress will confirm that I have not done anything contrary to law.”