A man accused of setting a fire inside a crowded Capitol Hill gay nightclub on New Year’s Eve pleaded guilty to arson Friday in U.S. District Court in Seattle.

Musab Mohammed Masmari, 30, was charged in a felony information in federal court Thursday after previously having been charged with first-degree arson in King County Superior Court.

On Friday, he signed a plea agreement in which federal prosecutors and defense attorneys agreed to recommend a five-year prison sentence for the crime, which carries a mandatory-minimum five- to 20-year penalty. Masmari will also be supervised for five years after he is released.

Sentencing is scheduled for July 31 before U.S. District Judge Ricardo Martinez.

Unlimited Digital Access. $1 for 4 weeks.

The federal takeover of the case ensures Masmari will serve more than twice the prison time than if he had been convicted in state court, said U.S. Attorney Jenny Durkan.

It also lends weight to allegations that Masmari’s crime is terrorism- or hate-motivated. The case is being prosecuted by Assistant U.S. Attorney Todd Greenberg, who supervises the Joint Terrorism Task Force.

King County Prosecutor Dan Satterberg praised the collaboration between state and federal agencies in investigating and prosecuting the case.

Greenberg said the motive for the arson will be addressed at Masmari’s sentencing.

In a news release, Durkan said, “This defendant violated people’s right to gather safely.”

A friend of Masmari’s contacted the FBI in early January to say he was concerned Masmari “may be planning some terrorist activity,” according to search-warrant documents filed earlier in King County Superior Court. The friend, who was not identified by authorities, worked as a confidential informant for the FBI and Seattle police after the fire, the documents say.

The friend also told investigators that Masmari, on a number of occasions, expressed his “distaste for homosexual people” and thought they “should be exterminated,” the documents said.

Police say Masmari avoided a security check at Neighbours by entering an adjacent bar called Therapy Lounge. He then passed through an interior door between the bars into the two-floor dance club and was seen on surveillance footage walking around with an object that appeared large enough to contain a 1-gallon gas can, according to the state charging documents.

Masmari allegedly fled the club within seconds of flames first appearing on the footage, the papers say. Club patrons and a bartender quickly doused the blaze with a fire extinguisher.

There were more than 750 people inside the club that night, authorities said.

Police released grainy surveillance photos of the suspect in January, and several people called in tips to police, including the friend named in the warrant, according to information presented in the arson case.

Days before his arrest on Feb. 1, Masmari — who also goes by the surnames Masmari and Al Masmari — booked a one-way flight to Turkey. He was arrested as he was preparing to leave for Seattle-Tacoma International Airport, police said.

Masmari was born in California, but his family returned to Libya when he was an infant; he came back to the United States permanently in 2009, according to charging paperwork filed in the arson case.

Mike Carter: mcarter@seattletimes.com or 206-464-3706

Information from Seattle Times archives is included in this report.