President Barack Obama's uncle has been granted permission to stay in the US, despite ignoring a deportation order more than two decades ago.
Judge Leonard Shapiro said Onyango Obama, a 69-year-old who has lived in the country for more than 50 years, "appears to me to be a gentleman," citing a law that entitles immigrants to permanent residency if they arrived before 1972, have lived there since and are of good moral character.
Mr Obama's immigration status didn't become public until his 2011 drunk driving arrest in Framingham, 20 miles west of Boston. The charge was dismissed after he completed a year of probation and 14 weeks of alcohol education classes.
The judge said he considered testimony about Obama's character, including letters from people who praised him for being a "kind and decent person," and considered the drunk driving charge and allegations of discrepancies in what he told immigration officials 20 to 30 years ago.
Mr Obama, who was born in Kenya, is the half-brother of the President's late father. He entered the country on a student visa in 1963, and after a series of immigration hearings in the 1980s was ordered to leave the country in 1992 but remained.
Obama told the judge he had led a quiet, simple life, graduating from high school in Cambridge, then attending Boston University, where he received a degree in philosophy. He said he has worked for years as a manager at a family-owned liquor store in Framingham. He also said he has worked for decades to help African immigrants find housing and settle in the US.
He added that he had been a hard worker, paid income tax and been arrested only once.
Asked about his family in the US, he said he has a sister and two nieces, then added, "I do have a nephew." Asked to name the nephew, he said, "Barack Obama. He's the president of the United States."
He described America as "a land of opportunities, a land of chances."
Onyango Obama's lawyer, Margaret Wong, called him a "wonderful older gentleman."
She said: "He has earned his privilege to stay in the United States. He has been here for 50 years." Mr Obama could get US citizenship after five years, she added.
After the hearing, Obama quickly left the courthouse without speaking. Wong said he didn't receive any special treatment and was happy with the judge's decision.
Obama testified that President Obama stayed with him for three weeks in Cambridge while at Harvard Law School.
In the President's memoir, "Dreams from My Father," he writes about his 1988 trip to Kenya and refers to an Uncle Omar, who matches Onyango Obama's background and has the same date of birth.
There was no immediate comment Tuesday from the White House, which has said it expected the case to be handled like any other.