SAN FRANCISCO — A 25-year-old Serbian man is accused of hacking Redwood City-based video game company Electronic Arts and stealing codes and in-game currency for its popular soccer game FIFA 18, according to the U.S. Attorney’s Office.

Martin Marsich, whose last known residence was in Udine, Italy, made his first appearance in U.S. District Court in San Francisco on Thursday. Prosecutors said he is charged with intentionally accessing a protected computer without authorization to obtain information for the purposes of commercial advantage and private financial gain and accessing a protected computer to defraud and obtain anything of value.

Get breaking news and alerts with our free mobile app. Get it from the Apple app store or the Google Play store.

If convicted, Marsich faces a maximum sentence of five years in prison and a fine of $250,000.

The company discovered the intrusion on March 25. According to an affidavit by FBI Special Agent Justin Griggs, Marsich accessed EA’s database utilizing a script that allowed access to NBA Live 15 server, through which he was able to forge a connection with the FIFA 18 server. He then allegedly made changes to FIFA 18’s backend database by granting items, such as access to the game, to 25,000 player accounts.

According to the affidavit, EA believes Marsich sold FIFA codes and packs to buyers on the dark web.

Marsich also allegedly converted FIFA 18 packs, which contain random in-game players, into FIFA coins. The coins are a type of in-game currency that can be used to buy or sell in-game items, including players.

Altogether, EA estimates that it lost about $324,000 as a result of the unauthorized access.

EA examined logs and internet protocol, or IP, addresses to identify the hacker. The FBI also identified Marsich as a suspect using subscriber information obtained from Google and LinkedIn, Facebook records and data provided by Twitter, according to the affidavit.

Like our Facebook page for more conversation and news coverage from the Bay Area and beyond.

Marsich, who was in the United States on a sightseeing trip, was arrested at San Francisco International Airport on Wednesday night as he was getting ready to fly to Serbia, prosecutors said.

Following his initial appearance Thursday, Marsich was released to a halfway house on the condition that he post the equivalent of $750,000 in cryptocurrency for bail. A magistrate judge set his next court appearance for Aug. 13 to confirm the posting of the cryptocurrency and to set further dates in the case.