In a single intense week in late May, Specialist Manning and the former hacker, Adrian Lamo, traded instant messages about what Mr. Lamo described as Specialist Manning’s personal troubles with the military.

But over the course of those exchanges, Mr. Lamo said in a telephone interview on Monday, Specialist Manning also took credit for leaking a classified, explosive video of an American helicopter attack in Baghdad that left 12 people dead, including two employees of the Reuters news agency, which the Web site Wikileaks.org posted in April.

There was more: Specialist Manning also claimed he gave Wikileaks 260,000 classified United States diplomatic cables and video of a United States airstrike in Afghanistan that killed 97 civilians last year, Mr. Lamo said. “He was just grabbing information from where he could get it and trying to leak it.”

So the former renegade, who in 2004 pleaded guilty to hacking into the internal computer system of The New York Times, did something he had not expected when Specialist Manning first contacted him: He turned him in.

On Monday, the Department of Defense announced that Specialist Manning, of Potomac, Md., had been arrested and was under investigation. A three-paragraph statement said that Specialist Manning, who is deployed with the Second Brigade, 10th Mountain Division in Baghdad, was in pretrial confinement in Kuwait “for allegedly releasing classified information.”

It is unclear whether Mr. Lamo is the main source against Mr. Manning, or if the military has developed other evidence. The Pentagon would not discuss the investigation.

Specialist Manning’s family members could not be reached for comment, but Wired’s Threat Level blog, which broke the news of the arrest and Mr. Lamo’s role in it, reported that his father, Brian Manning of Oklahoma, was shocked.

“I was in the military for five years,” Wired quoted Mr. Manning as saying. “I had a secret clearance, and I never divulged any information in 30 years since I got out about what I did. And Brad has always been very, very tight at adhering to the rules. Even talking to him after boot camp and stuff, he kept everything so close that he didn’t open up to anything.”

Mr. Manning told Wired that his son “is a good kid. Never been in trouble. Never been on drugs, alcohol, nothing.”

The leak of the helicopter video, which Wikileaks titled “Collateral Murder,” caused serious consternation at the Pentagon, where senior officials are increasingly concerned about technology that makes it easier to anonymously post documents, photographs and videos online. In April, Defense Secretary Robert M. Gates criticized the helicopter video as a portrayal of war as seen “through a soda straw.”

But opponents of the Iraq war have said that the video provided irrefutable evidence of a military blunder, and that it should not have been classified.

The episode also drew wide attention to Wikileaks, a once-fringe Web site that aims to bring to light secret information about governments and corporations. It was founded three years ago by Julian Assange, an Australian activist and journalist, and has published documents about toxic dumping in Africa, protocols from Guantánamo Bay and e-mail messages from Sarah Palin’s personal account.

In the interview on Monday, Mr. Lamo said he had contacted the Army about Specialist Manning’s instant messages because he was worried that disclosure of the information would put people’s lives in danger. He said that Army investigators were particularly concerned about one sensitive piece of information that Specialist Manning possessed that Mr. Lamo would not discuss in more detail.

“I thought to myself, ‘What if somebody dies because this information is leaked?’ ” he said.

So far, Wikileaks has not posted any video of the American airstrike in Afghanistan, although it claims to have it. That video, like the helicopter video, is said to be encrypted, meaning it is protected by a secret code. Working over months, Wikileaks said it was able to decrypt the helicopter video; Mr. Lamo said Monday that he understood that Wikileaks had not yet decrypted the Afghanistan attack video.

In Twitter messages on Monday, Wikileaks denounced both Mr. Lamo and Kevin Poulsen, a co-author of the lengthy Wired Threat Level blog post, as “notorious felons, informers & manipulators” and said that “journalists should take care.” Wikileaks also said that reports that the Web site had been sent 260,000 classified embassy cables “are, as far as we can tell, incorrect.”

Mr. Lamo, reached at his parents’ home in Carmichael, Calif., said that he turned over copies of his chat logs with Specialist Manning to Army investigators, and that they included much personal information that could give clues to Specialist Manning’s motives, should he indeed turn out to be the leaker.

Asked to specify what he saw as Specialist Manning’s motives, Mr. Lamo replied: “Ideology. I think he was dissatisfied with certain military policies and he wanted to adversely affect U.S. foreign policy.” Mr. Lamo would not provide more details. “It’s a personal matter for him, and I do not think it was one his family would want aired in the national media,” he said.

Mr. Lamo, 29, said he had expressed concern to Specialist Manning during the course of their exchanges. “I told him he would be in a world of hurt if he was found out,” he said. “In retrospect I wish I had tried to talk to him more.”

Mr. Lamo said he had promised the F.B.I. he would testify against the specialist. “I’ll keep my word, but I won’t do it happily,” he said. “I hope that his parents can forgive me. I’m sorry about what happened to their boy. But I was backed into a corner ethically.”

In Twitter messages on Monday, Mr. Lamo continued the theme. “I outed Brad Manning as an alleged leaker out of duty,” he said in one. “I would never (and have never) outed an Ordinary Decent Criminal. There’s a difference.”

In another Twitter message, Mr. Lamo said: “I know what it’s like to be 22, scared, and in shackles too. I’ve been there. I hope none of you ever have to make a choice like this.”

After Mr. Lamo pleaded guilty to hacking into The New York Times — he had also hacked into Yahoo, WorldCom and Microsoft — he was sentenced to six months of house arrest at his parents’ home and two years of probation. He said in the interview that he saw a difference in the level of wrong of hacking into The Times, which he acknowledged was illegal but did not, he said, compromise national security.

By Mr. Lamo’s account, Specialist Manning reached out to him on May 20, after an article on Wired’s Threat Level blog described Mr. Lamo’s struggles with Asperger’s disorder and his history as a hacker.