U.S. Department of Housing and Urban Development Secretary Ben Carson's attendance at President Donald Trump's Phoenix political rally created buzz on social media among those questioning whether the Hatch Act was violated.

The short answer: no.

The Hatch Act of 1939 prohibits federal executive-branch employees from engaging in partisan political events — like Tuesday's rally.

The law does not apply to the president, vice president or employees appointed by the president with the advice and consent of the U.S. Senate, according to the U.S. Office of Special Counsel.

Carson, who was appointed by Trump and confirmed by the Senate, was legally able to attend the rally.