A Utah man arrested on Wednesday in connection with suspicious letters sent to President Donald Trump and other top officials confessed to sending the four envelopes, which initially tested positive for the poison ricin, according to a court document.

The letters turned out to contain ground up castor beans, from which ricin is derived. No one was injured.

William Clyde Allen III, 39, a former member of the U.S. Navy who lives in Logan, Utah, was arrested on Wednesday and his home was searched, authorities said.

William Clyde Allen III Davis County Sheriff's Office

A probable cause affidavit said Allen on Wednesday "confessed to having purchased castor beans and having sent the letters," which were addressed to Trump, FBI Director Christopher Wray, Secretary of Defense James Mattis and the Chief of Naval Operations, Adm. John Richardson.

The affidavit says Allen sent the letters on or about Sept. 24.

"All four letters sent by Allen tested positive for ricin poison," the affidavit stated.

The document does not give any indication of a motive.

Allen is being held on suspicion of threat of terrorism, according to jail records. The U.S. Attorney’s Office for the District of Utah will file federal charges Friday, FBI spokesman Doug Davis has said.

Online records do not show if Allen has an attorney, and attempts to locate family members on Wednesday were not successful.

Allen enlisted in the U.S. Navy in October 1998 and left the service in 2002, the Navy said. He was listed as a damage control fireman apprentice, according to the Navy.

Neighbors told NBC affiliate KSL of Salt Lake City that Allen is married and appeared to be friendly.

"There's nothing that I saw in him that would raise red flags as far as this type of behavior," neighbor Darrell Robison told the station. "Nothing."

The letters to Mattis and Richardson were intercepted at a mail facility on the Pentagon campus but not within the main building itself, Pentagon spokesman Christopher Sherwood has said.

On Tuesday, the Secret Service said in a statement that it intercepted a "suspicious envelope" addressed to the president. The envelope was intercepted at a location outside of the White House, the Secret Service said.

Ricin is a poison produced naturally in castor beans, but it takes a deliberate act to make ricin and use it to poison people, according to the Centers for Disease Control and Prevention. It works by getting in the cells of a person's body and preventing the cells from making the proteins they need, which can cause the cells to die and can cause the death of the person affected, according to the CDC.