A gay astronomer who was fired for his sexuality in 1957 has finally received a formal apology from the US government.

Franklin Kameny, 84, received a letter of apology from John Berry, the highest-ranking gay official in the Obama administration, on behalf of the federal government.

It read: “In what we know today was a shameful action, the United States Civil Service Commission in 1957 upheld your dismissal from your job solely on the basis of your sexual orientation.”

It added: “And by virtue of the authority vested in me as Director of the Office Of Personnel Management, it is my duty and great pleasure to inform you that I am adding my support … for the repudiation of the reasoning of the 1957 finding by the United States Civil Service Commission to dismiss you from your job solely on the basis of your sexual orientation. Please accept our apology for the consequences of the previous policy of the United States government.”

Kameny, who was told in 1957 that he was “automatically a security risk” and a “disruptive personnel factor”, has accepted the apology. He was also honoured with the department’s most prestigious award, the Theodore Roosevelt Award.

After being fired, he went on to become one of the most significant figures in the US gay rights movement. He founded the Mattachine Society of Washington, one of the earliest gay and lesbian campaigning societies and became the first openly gay candidate for Congress in 1971.