Onyango Obama, the uncle of President Obama, arrives for a hearing at a federal immigration court in Boston, Mass., on Tuesday. (BRIAN SNYDER/REUTERS)

A U.S. immigration judge ruled Tuesday that President Obama’s Kenyan-born uncle can stay in the United States as a lawful resident, despite dodging deportation for decades and a 2011 drunk-driving arrest.

Judge Leonard Shapiro said his decision was based on a federal law granting green cards to foreigners who arrived in the United States before 1972, as long as they are found to be of good moral character.

“He appears to me to be a gentleman and I’m inclined to grant his application on that basis,” Shapiro said after Onyango Obama, the 69-year-old half-brother of the president’s deceased father, was questioned by attorneys.

Obama came to the United States as a teenager in 1963 to attend an elite school near Boston, but allowed his visa status to lapse in 1970. He was denied green-card status in the 1980s and was asked to leave the country, but he did not leave.

His deportation order came to light after he was arrested and charged with drunk driving in August 2011 in Framingham, Mass., where he has worked for more than 11 years at a convenience store.