Department of Housing and Urban Development Secretary Julián Castro, rumored to be on former Secretary of State Hillary Clinton’s shortlist for vice president, violated federal election law when discussing and endorsing Clinton during an April interview with Yahoo News.

According to a report from the U.S. Office of Special Counsel, first reported by Buzzfeed, Castro violated the Hatch Act, which prohibits federal employees (and cabinet members) from using their official position to influence an election.

During the April 4 interview with Yahoo News’ Katie Couric, Castro “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,” the OSC said in a letter to President Obama.

Per the letter to President Obama, Castro’s 18-minute interview with Couric began with approximately seven minutes of discussion about HUD-related issues, including: “ConnectHome, a HUD program to expand Internet access to families in public housing. He then discussed the affordable housing crisis in America, home ownership, the difficulties of getting a home loan, and the National Housing Trust Fund, another HUD initiative.”

According to the OSC, Castro conducted the interview from HUD’s broadcast studio, with the official HUD seal “visible behind him.”

And in the eyes of the OSC, those factors, plus the fact that Couric repeatedly referred to Castro as “Mr. Secretary” throughout the interview, helped determine that the interview qualified as an official duty of the HUD Secretary.

But after roughly seven minutes, Couric said to Castro, “Mr. Secretary, let’s move on to politics,” and asked Castro about his endorsement of Clinton.

Castro responded by saying, “now taking off my HUD hat for a second and just speaking individually, it is very clear that Hillary Clinton is the most experienced, thoughtful, and prepared candidate for president that we have this year.”

During the interview, Castro went on to discuss Clinton’s achievements as Secretary of State, her prospect and potential as president, as well as criticizing the Republican Party and its candidates, including soon-to-be presidential nominee Donald Trump.

According to the OSC, Couric asked Castro what made him most fearful about Donald Trump being president.

Per the OSC letter, Castro responded that “Mr. Trump is not prepared for the office of president because Mr. Trump does not understand what leadership or being president is about, or the basic functions of our government or its relationships with other countries.”

Couric then pivoted the interview to ask Castro about his interest in serving as Clinton’s vice president, to which he responded: “What I am interested in, though, is trying to do a great job here at HUD and serving the people that we do serve, folks that are of modest means but who deserve our attention and our efforts. And so I don’t believe that is going to happen, but I am supportive of Secretary Clinton and I believe she is going to make a great president.”

In the eyes of the OSC, Castro’s phrase, “now taking off my HUD hat for a second and just speaking individually,” was not enough of a disclaimer to “negate the fact that he was appearing in his official capacity for the rest of the interview,” and is therefore, a violation of the Hatch Act.

According to the OSC, Castro has received four separate briefings on the Hatch Act since he began serving as HUD Secretary in July 2014, including a Hatch Act briefing in February 2016.

The OSC said that Castro was advised on how to handle political questions when operating as HUD Secretary and vice versa, and that HUD ethics officials testified that they believed Castro “should have known that he could not switch from speaking in his official capacity to speaking in his personal capacity at an event or during an interview.”

According to the OSC, Castro testified after the interview that he felt he had operated in accordance with the Hatch Act during the interview, but has since “reconsidered his position.”

The OSC letter states that Castro has since stated:

"Based on the information I received regarding the interview in advance of the meeting, I expected that Ms. Couric’s questions would focus primarily on HUD’s activities and the growth of cities. When, during the live broadcast, I received the direct questions regarding specific candidates, I used the inelegant phrase “taking off my HUD hat” to indicate my intention to respond in my personal capacity, and not as a representative of HUD. My aim was to make clear to anyone viewing the broadcast that, when answering those direct questions regarding candidates, I was not acting in my official capacity … I now have watched the recording of the interview and appreciate that, while my intention was to avoid any blurring of roles and make clear that I was not speaking as a representative of HUD, that fact may not have been obvious to viewers. At the time, I believed that, so long as I clearly stated that I was not speaking in my official capacity, my actions would be consistent with Hatch Act requirements. I now understand that the mixed-topic interview, even with a proviso, is problematic."

The OSC also stated that Castro “expressed regret” in regards to his actions during the interview and said it was not his intention to violate or “to be perceived as violating” the Hatch Act.

Additionally, Castro said that he is “confident no similar blurring of roles will occur in the future” and directed the OSC to a later interview where he chose not to comment on the election because he was appearing in his official capacity.

Despite those contentions, the OSC still found that Castro violated the Hatch Act and “impermissibly mixed his personal political views with official government agency business,” and submitted its report to President Obama for his review.