The American arrested in Russia on suspicion of spying met with the United States ambassador on Wednesday, and the secretary of state said he would demand the man’s return if the detention was “not appropriate.”

Russia’s domestic security agency said on Monday that it had detained the American, Paul N. Whelan, three days earlier “during an act of espionage,” a crime that in Russia can carry a term of up to 20 years in prison. The agency, the Federal Security Service, or F.S.B., said it had opened a criminal case against Mr. Whelan but provided no other details.

On Tuesday, the State Department said it was still waiting for Russian authorities to provide consular access to Mr. Whelan, a Marine Corps veteran whose family said he was in Moscow to attend a wedding.

That access was granted on Wednesday, a State Department spokesperson said, when Ambassador Jon M. Huntsman Jr. visited Mr. Whelan at the Lefortovo Detention Facility in Moscow. Mr. Huntsman offered the American Embassy’s assistance, and later spoke with Mr. Whelan’s family by phone.