(CNN) -- A judge in the United Arab Emirates on Thursday sentenced an American to one month in jail for being in possession of police handcuffs, his lawyer said.
Adam Foster, 30, of Burdett, New York, was taken into custody at the conclusion of the hearing in Dubai to begin serving his sentence, his lawyer, Yousuf Khalifa Hammad, told CNN.
Foster had been detained for more than two months in the UAE on charges of stealing police handcuffs, an allegation he vehemently denied and said he only confessed to after being tortured.
"I can't say he was happy. But he didn't show any (anger). He accepted the judgment," Hammad said.
The judge's ruling brings to an end a case that was the focal point of a grassroots writing campaign organized via Facebook. Nearly 2,000 people wrote letters to the UAE's ambassador to the United States on Foster's behalf, demanding his release.
"Thanks to everyone that who has supported me during all of this," Foster wrote in a brief message late Wednesday on Facebook. "I can't stress enough how much that means to me. Court is in less than 12 hours.. not going to get much sleep tonight."
Foster faced up to seven years in prison on charges of theft of government property, possession of police paraphernalia and theft at night. Officials in the UAE did not responded to multiple requests by CNN for comment.
Foster has been given credit for four days served during his initial detention and could have an additional seven days shaved off his sentence for good behavior, Hammad said.
The U.S. State Department has confirmed that Foster has been detained since February 26. American consular officers met him on February 28 before UAE authorities released him on bail March 1.
Investigators claim Foster stole a pair of official police handcuffs during questioning in an unrelated matter at a Dubai police station the night before he was due to leave the city, according to his attorney, Hammad.
Foster has said it was a coincidence, saying he was brought in for questioning because he was in possession of a bottle of Korean rice wine -- a parting gift from colleagues. He was released without charges.
Foster said he found the handcuffs a day earlier on the ground at a mall parking lot, about a mile and half from the police station where he was questioned.
"I was thinking 'souvenir,'" Foster told CNN last week. "They were lying on the ground. So I picked them up."
Foster, who was on his way home after a six-week stint as a contractor for Dubai Energy Water Authority, was arrested after authorities found the handcuffs in his luggage during a routine security screening at the Dubai airport.
After hours of maintaining his innocence during police questioning, he was beaten and forced to confess, Foster said.
He claims he was told to take off his shoes and socks, and handcuffed to a chair while one of two officers used a coil to whip the bottom of his feet. He also said he was punched in the face.
Foster said he then signed a confession written in Arabic.
Foster said he recanted his confession after he was released from jail.
Nearly 2,000 people appealed to Yousef al Otaiba, the UAE ambassador to the United States, and Jeffrey D. Feltman of the State Department's Bureau of Near Eastern Affairs to intervene on Foster's behalf.
"Thinking of you and praying for strength for you and your family!" wrote Facebook user Christin Cherkis Bresett.
Hundreds of others have posted messages of support.
Last year, UAE authorities detained Nicholas Moody of Nevada for more than three months on charges of possessing weapons accessories -- parts that could accompany a gun, though no firearm itself.
Moody was arrested during an 18-hour layover in Abu Dhabi while heading back from Iraq. A judge later dismissed the charges.