Vaughan Dowd, 55, vandalised the front door of the home of Jackson Yamba, 38, five days after the solicitor moved into the same block of flats where the defendant lived in Irlams o' th' Height in Salford, Greater Manchester.
Dowd, a single man with no children, led a "sad life", spending his time working then drinking alcohol and watching television, and "Brexit and immigration" was "playing on his mind" at the time, Manchester Crown Court heard.
After seeing the graffiti as they left home for work and school, the 10-year-old boy became tearful and Mr Yamba said the attack had left him fearful and angry.
The same graffiti was also daubed in the same white paint on an internal communal door and the entry door to the block of flats.
Dowd, a self-employed gardener, pleaded guilty at an earlier hearing to a single count of racially aggravated criminal damage on February 8.
Jailing him for 12 months, Judge Alan Conrad QC told the defendant: "This country, in particular this area, the cities of Salford and Manchester, have a long and proud history of diversity and inclusivity.
"We welcome those who, having a right to come here, do so and when they do, lead decent and productive lives.
"What you did was not welcome in any civilised society.
"You have experienced anxiety, but then again many people experience anxiety and would not dream of behaving as you did.
"In reality, this was simply an outpouring of racist views held by you for which there is no excuse.
"It must be made clear that imprisonment will follow offences such as this."
Iain Johnstone, defending, said Dowd only had one previous conviction - from 27 years ago, when he forged a work sick note - and was effectively "of good character".
He said Dowd described himself as a "grey man" who led a sad life and would "plod along".
Mr Johnstone said his client came from a respectable family, and did not present as someone with "entrenched" racist views, and his family, friends and neighbours found his actions inexplicable.
He added: "It appears what happened ... in some way Brexit and immigration was playing on his mind.
"Mr Dowd maintains he's not racist."
Mr Johnstone read a reference from Dowd's family, which said: "They would like to sincerely and utterly and unreservedly apologise for this upset to Mr Yamba and his son and everyone who this incident has caused upset and offence to.
"There must be something underlying for this to have happened."
Outside court Mr Yamba welcomed the sentence, but said racism, not Brexit, were behind Dowd's actions.
He said: "What's Brexit have to do with it? People can debate about it. I don't think it's Brexit, just racism.
"I think it's quite a good sentence. It reflects the gravity or seriousness of the offence for me, and I think it sends a clear message."
The matter only came to light after Mr Yamba, who came to the UK from the Democratic Republic of Congo in 2006, tweeted a photo of his front door and complained that no police had been to see him after he reported the attack.
It led to uproar online, and an apology from Greater Manchester Police Chief Constable Ian Hopkins.
Dowd was caught by CCTV installed in the flats and by police checking the record of key-fob entries to the block.
He has now lost his tenancy at the housing association flats where he had lived for 25 years but Mr Yamba is also considering leaving.
While heartened by the many gifts and messages of support from locals, Mr Yamba said he worries about bringing his son up in the area and may move out of Greater Manchester.
Vaughan Dowd admitted racially aggravated criminal damage at Jackson Yamba's apartment in February while Brexit and immigration were playing on his mind.
He apologised to Mr Yamba and insists he's not a racist.... but his victim disagrees:-