A Pennsylvania artist whose Facebook selfies and video inside the U.S. Capitol during the Jan. 6 riot helped lead authorities to his arrest was sentenced Thursday to 18 months’ probation and to pay a fine.

Andrew Wrigley, 50, of Jim Thorpe appeared in federal court in Washington on Thursday, apologizing for his actions. Wrigley, one of the first nationwide to be arrested in connection with the riot, pleaded guilty in September to one misdemeanor count of parading, demonstrating, and picketing in a Capitol building.

“I respect our legal institutions and I think they are what makes America great,” Wrigley told U.S. District Judge Amy Berman Jackson. “All I wanted to do that day was just wave the flag and be patriotic, stand and be seen. But I should have had the common sense and the judgment to stand 1,000 feet back.”

Despite the government’s push to put him on house arrest, Jackson sentenced Wrigley — a painter with an interest in hand-making leather shoes — to 18 months of probation in Pennsylvania, community service, and a $2,000 fine. Separately, the judge ordered Wrigley to contribute $500 in restitution toward the $1.5 million in damage to the Capitol when a violent mob stormed the building in support of President Donald Trump as Congress inside worked to certify the results of the election.

According to court documents, Wrigley gathered with others attending the “Stop the Steal” rally in a Doylestown church parking lot, departing on a tour bus to Washington.

Arriving at the rally, he walked toward the Capitol, past broken barricades and police officers and through the open door of the breached building.

Inside the Capitol for about a minute, Wrigley snapped a selfie, which he posted to Facebook, with the caption: “At the protest in DC at the capitol building #stopthesteal.”

It was his Facebook friends who reported him to the FBI.

“This was not a kind of peaceful protest of citizens, but it was the hive mind acting with anger, violence, and committing criminal acts,” Assistant U.S. Attorney Mona Furst said.

At least 676 people — including 58 from Pennsylvania — have been arrested in connection with their participation in the riot.

To the Capitol on Jan. 6, Wrigley brought a Bennington flag, which features the number 76 and 13 stars and 13 stripes. References to 1776 and the American Revolution have grown popular among the far right.

Wrigley’s attorney, Ann C. Flannery, told the judge that her client had purchased the flag while living in Center City and it was “a point of civic pride.”

“Our basketball team is called the 76ers. It’s not a symbol of revolution in the way the government describes it,” Flannery said.

No matter Wrigley’s intent, the judge noted that it was “not a very good analogy.”

“The point of 1776 was to let the people decide who would rule them,” she said. “The point of the attack on the Capitol was to stop that from happening. The point of the attack on the Capitol was to subvert democracy, to substitute the will of the people with the will of the mob.”

Wrigley told the court that if he could go back in time, he would have stayed “far away from the danger zone.”

“That day cost me a lot,” he said.

Later, while handing down the sentence, the judge responded: “That day didn’t just cost you a lot, Mr. Wrigley. It cost our country a lot.”

Staff writer Jeremy Roebuck contributed to this article.