US president Donald Trump has weighing in on the racist photo that appeared in the medical college yearbook of Virginia governor Ralph Northam.

Democratic officials in Virginia and nationally urged Mr Northam to resign after news reports of the photo, which appeared in Mr Northam’s 1984 medical school yearbook and showed a person in blackface and a person in Klan regalia.

Mr Northam refused to resign, however, and said on Saturday that he was not either of the people pictured.

In tweets on Saturday night, Mr Trump criticised Mr Northam over his recent comments on late-term abortion.

He also said that Mr Northam’s Republican opponent in the 2017 governor election, Ed Gillespie, would have won had the photo turned up during their campaign.

Earlier this week, abortion opponents accused Mr Northam of supporting infanticide.

In a radio interview, the governor described a hypothetical situation in which an infant who is severely deformed or unable to survive after birth is left to die.

Mr Trump tweeted after those comments that “Democrats are becoming the Party of late term abortion”.

As calls mounted on Saturday for Mr Northam to resign because of the photo, Mr Trump tweeted: “Democrat Governor Ralph Northam of Virginia just stated, ‘I believe that I am not either of the people in that photo.’ This was 24 hours after apologizing for appearing in the picture and after making the most horrible statement on ‘super’ late term abortion. Unforgivable!”

In a second tweet, Mr Trump wrote: “Ed Gillespie, who ran for Governor of the Great State of Virginia against Ralph Northam, must now be thinking Malpractice and Dereliction of Duty with regard to his Opposition Research Staff. If they find that terrible picture before the election, he wins by 20 points!”