US Navy names ship after assassinated gay rights campaigner
Harvey Milk was one of the first openly gay elected politicians in the United States (AFP)

One of the first openly gay politicians in the United States, who was assassinated four decades ago, will have a ship named after him this weekend, as the US military looks to keep step with modern-day social attitudes.

The USNS Harvey Milk honors a former navy diver who served at a time there was a ban on homosexuality in the armed forces, and who was later shot dead in San Francisco, months after winning public office.

The naming ceremony for the 227-meter (744-foot) refueling vessel in San Diego on Saturday will be attended by Secretary of the Navy Carlos Del Toro.

"Leaders like Harvey Milk taught us that diversity of backgrounds and experiences help contribute to the strength and resolve of our nation," Del Toro said, according to a Navy press release.

"There is no doubt that the future sailors aboard this ship will be inspired by Milk's life and legacy."

Milk, who was frank about his sexuality after his time in the military, was elected to San Francisco's Board of Supervisors, where he was instrumental in passing laws banning discrimination on the grounds of sexual orientation.

Just months later, in 1978, Milk was shot dead along with mayor George Moscone, by a disgruntled former city supervisor.

His killer, Dan White, pleaded diminished responsibility, saying he was suffering from depression and had eaten a lot of sugary foods, in what was dubbed the "Twinkie defense".

White was convicted of voluntary manslaughter and sentenced to five years in jail, a verdict that sparked outrage, particularly in San Francisco's gay community.

Milk's murder helped to fix his reputation as a civil rights icon, and he was posthumously awarded the Presidential Medal of Freedom.

The Navy announced five years ago that it would name a ship after Milk, along with vessels for civil rights leaders including abolitionist Sojourner Truth and suffragist Lucy Stone.

This is not the first official tribute to Milk by the United States: in 2014, the US Post Office issued a stamp with his image, where he appeared smiling next to a rainbow flag.

Sean Penn won a best actor Oscar for his portrayal of the activist in the 2008 film "Milk".