Virginia’s governor acknowledged on Friday that he was photographed more than 30 years ago in a costume that was “clearly racist and offensive” — admitting that he had dressed either as a member of the Ku Klux Klan or in blackface — but resisted a flood of calls for his resignation from national and state Democrats.

“I am deeply sorry for the decision I made to appear as I did in this photo and for the hurt that decision caused then and now,” Ralph Northam, the Democratic governor, said in a statement on Friday evening.

In a subsequent video, Mr. Northam said he was “ready to do the hard work of regaining your trust” and was committed to staying in office “through the remainder of my term.”

Mr. Northam issued his statement hours after the photograph — which was included on his 1984 yearbook page from Eastern Virginia Medical School and appeared alongside other pictures of himself — became public. Neither person in the black-and-white photograph was identified, and Mr. Northam, a pediatric neurologist, did not confirm which costume he had worn.