A Boston immigration judge has set a Dec. 3 hearing to determine if President Obama’s uncle, ­Onyango ­Obama, should be deported to his native Kenya 50 years after he first arrived in the ­United States.

Immigration Judge Leonard I. Shapiro set the date at a short preliminary hearing Wednesday. After­ward, Obama’s lawyer, Scott Bratton, said he will ask the judge to grant Obama legal residency, in part because he has lived here for so many years.

“Everybody wants to stay in America,’’ said Bratton, who is based in Cleveland. “Hopefully, on Dec. 3, the case will be over.’’

Obama, a 68-year-old liquor store manager, came to America at age 19 in 1963 to attend an elite boys’ school in Cambridge. He gained renown as a soccer star, but soon dropped out of school and was ordered deported several times, most recently in 1992.

But he never left and lived under the radar until Framingham police arrested him in August 2011 on drunken driving charges. Obama admitted to sufficient facts in the criminal case and was sentenced to a year’s probation, after which the case would be dismissed. Then, in November, the Board of Immigration Appeals reopened his immigration case, based in part on his assertion that his prior lawyer, now dead, was ineffective.

Wednesday, few in Shapiro’s packed courtroom noticed when the president’s uncle arrived dressed in a brown jacket and sneakers and took a seat in the front row. He waited for more than an hour with more than 30 immigrants from Pakistan, Guatemala, Uganda, their faces creased with tension over the threat of being deported.

As Obama watched, Shapiro gave one woman until May to leave the United States or face forcible deportation, similar to the kind of warning an immigration appeals board gave Obama himself in 1992.

“If you don’t leave then, you’ll be ordered to be deported,” Shapiro warned the woman, “and you don’t want to have that happen.”

It is unclear why Obama was never deported. His immigration history is murky because court files are private, but judges’ decisions obtained by the Globe under the Freedom of Information Act show that he was first ordered deported in 1986 because he had no legal basis to stay in the United States. He was ordered deported again in 1989 and lost an appeal to stay in the country in 1992.

Obama has declined multiple requests for interviews about his case and said only a few words during the hearing, such as, “That’s me,” when the judge asked his name.

Afterward, Obama dashed away from reporters assembled in front of the John F. Kennedy Federal Building, where the courts are located, and refused to answer questions.

Bratton said he will seek legal residency for Obama through registry, a section of federal immigration law that lets immigrants apply for a green card as long as they arrived before 1972, have good moral character, and meet other requirements.

Shapiro, a veteran immigration judge, also presided over the deportation case of the president’s aunt, Zeituni Onyango, in the same courtroom. She had been living illegally in the United States in Boston public housing when her status was leaked to news organizations just before the president’s historic election in 2008.

Shapiro had denied asylum to her before, but granted it in 2010, in part because of the unauthorized exposure of her case to news organizations.

The uncle’s hearing was held one day after President Obama called for a path to US citizenship for the 11 million illegal immigrants in the United States, as long as they do not have serious criminal ­records.

The president barely knew his father, who died in a car crash in 1982, but critics have said that ­Onyango Obama, who is the president’s father’s half-brother, appears to be getting special treatment. He was released from detention soon after his arrest, despite the outstanding deportation order, and secured a federal work permit so that he could return to work at a liquor store.

After his arrest, Framingham police said Obama told them: “I think I will call the White House.”

The Executive Office for Immigration Review, the agency under the Department of Justice that runs the immigration courts, had refused to confirm ahead of time that Obama had a hearing Wednesday, to protect his privacy.

“In order to discuss some cases, a privacy waiver is required,” said courts spokeswoman Kathryn Mattingly.

But Obama’s name was listed with the other cases for the week and his hearing was open to the public.