A D.C. man who expressed hatred for minorities and glorified violence on social media disavowed what he called his “disturbing online presence” and pledged to “stay away from the darkest corners of social media” as he was sentenced Friday to 10 months’ time served on a gun charge in federal court.

Jeffrey Raphiel Clark Jr., 31, will be released from jail after being locked up since his arrest in November at his Bloomingdale neighborhood home, where investigators found fliers from a neo-Nazi organization, boxes of ammunition and a Nazi flag.

His arrest came after family members reported concerns about Clark’s behavior following the mass shooting at Tree of Life synagogue in Pittsburgh in October and the suicide of Clark’s younger brother. The FBI turned up Clark’s name among social media followers of the man since charged with hate crimes in the synagogue attack.

Clark had told investigators he was a member of white-nationalist groups and that he and his brother became interested in guns “because they believed there was going to be a civil war,” according to an account of his statement filed in court.

Standing at the courtroom podium Friday, and reading from notes, Clark said his experience at the D.C. jail had made him reevaluate his views and led him to try to improve himself “mentally and morally.”

“My words did have consequences,” he said before apologizing for the “damage” he had caused friends, family and the community.

Prosecutors and Clark’s attorney both recommended a sentence of 10 months, or time served, and the judge agreed after hearing directly from Clark for the first time.

U.S. District Judge Timothy J. Kelly said he was concerned about the animosity Clark previously expressed toward racial and religious minorities, but “we don’t punish people for having hate in their hearts.” He praised Clark for seeming to have distanced himself from those views.

Assistant U.S. Attorney John Cummings, in the government’s sentencing recommendation, had urged the judge to consider Clark’s mind-set before his arrest.

“The defendant’s online postings, statements, and items found inside his home, evidenced an individual with a deep-rooted hatred for certain minorities and a penchant for glorifying violence,” Cummings wrote.

The charge against Clark involved the volatile mix of guns and drugs, but much of the courtroom discussion Friday centered on whether the government should or could restrict Clark’s online speech after he is released from jail. The prosecutor had asked the judge, as a condition of ongoing supervision by the court, to prohibit Clark from “threatening behavior” online — and to require follow-up meetings with the FBI as requested by the bureau.

But the judge asked, “Is it appropriate for me to deal with the hatred?”

“As reprehensible as that may be, he has a right to hold those beliefs,” Cummings responded. “We’re not looking to interfere with his First Amendment rights, but he can’t threaten people.”

The judge agreed to impose a three-year term of court supervision but did not include the specific restrictions the prosecutor requested.

In explaining his client’s new perspective, Clark’s attorney David W. Bos told the court that Clark’s brother’s death and the time Clark has spent in jail have made him “reevaluate many of the choices he has made in his young life.” Only days before his arrest, Clark’s younger brother, Edward, 23, fatally shot himself on Roosevelt Island near Washington.

Clark “is deeply sorry for those choices and is committed to making better choices,” Bos wrote before the sentencing hearing. “He can’t escape his past but he has the motivation and support for a brighter future.”

Clark pleaded guilty in July to possessing a firearm while using or being addicted to illegal drugs — a charge that carries a maximum sentence of 10 years in prison. Clark has no previous criminal convictions, and prosecutors agreed to seek a sentence within the federal guidelines ranging from 10 months to 16 months.

The office of U.S. Attorney Jessie Liu noted in the plea agreement that its investigation “uncovered no evidence” Clark had advance knowledge of the attack on the Pittsburgh synagogue or that he “was planning an independent attack against similar targets” in Washington.

Before he was arrested, two relatives contacted the FBI and reported that Clark had become increasingly outspoken and agitated following his brother’s death, court filings show. The brothers had “fantasized about killing ‘Jews and blacks,’ ” the relatives told the FBI, according to the filing.

Clark was arrested Nov. 9 during a search of the home he shared with his father, brother and sister, according to court records. Agents said in court filings that they seized a marijuana-growing operation from his bedroom and three firearms — a handgun, a shotgun and a rifle.

Court filings provide details about Clark’s personal story. He moved from Utah to Washington as a teenager, and he graduated from St. John’s College High School in Northwest in 2007.

Before his arrest, prosecutors said Clark led an “aimless lifestyle.” He was unemployed, regularly used marijuana and played video games such as “Ethnic Cleansing.”

Clark told investigators he had smoked pot “on a nearly daily basis” since he was 15. “Clark had tried to stop using marijuana in the past, but had been unable to do so,” according to prosecutors.

His father and mother have attended every court proceeding, Clark’s lawyer wrote, and both have regularly visited him at the D.C. jail.