The family of Michael R. White, a Navy veteran imprisoned in Iran half a year ago, said Friday that he had traveled there with a valid visa to visit a female friend, rejecting any suggestion that he might have been engaged in espionage.

“We want to be very clear — Michael spent much of his time in the Navy as a cook and recently worked as a commercial janitor — he is not now, nor has he ever been a spy,” the family said in a statement.

Mr. White, 46, also had been undergoing treatment for cancer and other “serious medical conditions that could be life-threatening without regular, specialized medical care,” the statement said.

Image Michael R. White, an American Navy veteran, in an undated photograph provided by his family.

Mr. White, a 13-year Navy veteran from Imperial Beach, Calif., is the first American known to be imprisoned by Iran since President Trump took office nearly two years ago. Why Iran has taken him into custody is unclear.