Housing Secretary and potential Democratic vice-presidential prospect Julian Castro violated federal law when he touted Hillary Clinton's candidacy in a media interview earlier this year, according to a federal watchdog report released Monday.

The seven-page report by the U.S. Office of Special Counsel concluded Castro violated the Hatch Act, which bars most Executive Branch officials from expressing their political views while on official business. According to the report, he crossed the line during an April 4 interview that mostly was about HUD’s plans to increase Internet access to children and other agency-related issues.

Castro, though, responded to a question during the Yahoo News interview about Clinton’s presidential bid.

“Taking off my HUD hat for a second and speaking individually,” Castro said, while going on to call Clinton the most experienced 2016 candidate and criticizing Republicans. BuzzFeed News first reported on the OSC findings.

“Castro’s statements during the interview impermissibly mixed his personal political views with official agency business, despite his efforts to clarify that some answers were being given in his personal capacity,” states the OSC report, which will now be referred to President Obama, who will decide on what if any action to take.

Castro is considered a potential running-mate pick for Clinton as she prepares to name her choice going into the Democratic convention next week.

Castro, in response to the report findings, said he thought during the interview that he avoided violating the act but agreed with the OSC findings.

“I offered my opinion to the interviewer after making it clear that I was articulating my personal view and not an official position,” he said. “At the time, I believed that this disclaimer was what was required by the Hatch Act. However, your analysis provides that it was not sufficient.”

He also purportedly plans to provide training for top agency officials to avoid future violations.

The Obama administration recently said Cabinet-level officials like Castro cannot speak at next week’s Democratic National Convention in support of Clinton, the party’s presumptive presidential nominee.

In 2012, the OSC, which focuses on Hatch Act violations, concluded then-Health and Human Services Secretary Kathleen Sebelius also was in violation when she said at a Human Rights Campaign event that Obama should be reelected.

FoxNews.com's Joseph Weber contributed to this report.