A federal judge sentenced a former Florida postal worker to four months in prison Thursday for his gyrocopter flight last year to the U.S. Capitol, a campaign finance protest cited in recent demonstrations that led to 1,200 arrests in Washington.

“You had tunnel vision for publicity and media attention to yourself and not to the public-safety consequences,” U.S. District Judge Colleen Kollar-Kotelly told Douglas Hughes, 62, of Ruskin, Fla., ordering him to stay away from the White House and U.S. Capitol grounds after his release.

Hughes’s “publicity stunt” recklessly endangered others in what Kollar-Kotelly called an act of “self-aggrandizement.” She said she hoped a prison sentence would deter others “who might not be so lucky” to avoid accidental or intentional downing for violating no-fly zones around the nation’s capital.

Hughes pleaded guilty in November to one felony count of flying without an airman’s certificate for piloting his low-powered, 350-pound craft 70 miles from Gettysburg, Pa., to Capitol Hill on April 15, 2015.

Hughes admitted flying into restricted airspace without a flight plan and agreed to forfeit what was described as his “flying lawn chair,” which had a small motor-driven propeller and was modified to carry 10 gallons of gas and letters he planned to deliver to members of Congress.

Activists with the Democracy Spring movement have staged protests at the U.S. Capitol since April 11. (Jim Lo Scalzo/European Pressphoto Agency)

Prosecutors sought a 10-month sentence, calling it “miraculous” that no one was hurt in Hughes’s hour-long flight, which they said came within seven miles of 20 airports before ending with a low-altitude pass over the Mall at under 50 mph. The flight caused an extended lockdown on Capitol Hill.

Addressing the court before his sentence and asking for probation, Hughes, wearing a gray suit, expressed remorse and apologized to security agencies.

But Hughes said that he did not regret what he did “as a mailman delivering a message to Congress” and that he would keep speaking out against the influence of money in politics.

“I was not a risk to air traffic, commercial or private, at the altitude I was flying,” Hughes said. “My message for the last year has been that the crisis of corruption is within the power of the people to solve. . . . I predict this is only the beginning.”

Hughes played a game of “Russian roulette” with his life and that of the Washington community, Assistant U.S. Attorney Tejpal S. Chawla said.

“The hammer did not strike, but it was all a matter of luck,” Chawla said, adding that “a stray kite, a gust of wind, a child letting go some balloons” and the outcome could have been different.

Douglas Hughes held up a mock commemorative stamp design given to him as a gift while speaking to reporters outside federal court in May 2015. (Jacquelyn Martin/AP)

In a statement, the U.S. Attorney for the District, Channing D. Phillips, said the sentence holds Hughes “accountable for his reckless acts and hopefully will deter others from attempting to violate the airspace surrounding Washington, D.C.”

Hughes has been confined mainly to his home in Hillsborough County, Fla. On April 12, he dropped his publicized bid for Congress challenging Rep. Debbie Wasserman Schultz, the chair of the Democratic National Committee.

In previous court proceedings, Kollar-Kotelly denied a request by Hughes to join demonstrators with the self-described Democracy Spring movement, who marched from Philadelphia to Washington this month.

In protests timed to coincide with the anniversary of Hughes’s flight, demonstrators converged on Washington and have sparked 1,240 arrests since April 11, according to U.S. Capitol Police. Most of those arrests occurred on the East Front of the U.S. Capitol, with some in the Capitol Rotunda, police said.

Hughes denied that he planned his protest flight when questioned by the U.S. Secret Service, although he had blogged about the plans online, told a Tampa newspaper and wrote an email to an account associated with President Obama’s campaign describing his intent.

In plea talks, federal prosecutors dropped a felony charge of operating without an aircraft registration, three misdemeanor counts of violating national defense airspace and one misdemeanor count of operating a vehicle falsely labeled as a postal carrier.

In court, Hughes’s lawyers cited news reports and editorials that a “wealthy oligarchy of donors” dominates U.S. politics.

“Doug’s freedom flight was a flight dedicated to freedom of speech, to ending corruption and restoring democracy to the people,” attorney Mark L. Goldstone said, calling Hughes “a patriot” whose novel nonviolent protest followed in the tradition set by figures such as the Rev. Martin Luther King Jr. and Harriet Tubman.

Kollar-Kotelly disagreed, saying Hughes “was not in that league.” Civil disobedience in anti-slavery and desegregation movements targeted unjust laws, the judge said, adding that there was no relationship between campaign finance and the flight safety and national security regulations that Hughes violated.

The judge directed Hughes to “give careful thought” in prison to his advocacy plans “so you don’t wind up back in court.”