A man pulled a BB gun on his neighbour and fired twice at him because he was upset about loud music being played late at night.
Mindageas Stakele banged on the walls of his neighbour's flat in Spalding, Lincolnshire, in a bid to get the noise to stop, a court heard.
Neil Sands, in mitigation, said the incident happened because Stakele wanted to get to sleep as he had to get to work in the morning.
The victim said he was 'scared for his life' and felt a pain in his left shoulder as he was shot with a pellet, Lincolnshire Live reports.
Phil Howes, prosecuting, told Lincoln Crown Court that Stakele banged on the door of the neighbour just after midnight.
"The complainant went to open the door and was greeted by the defendant shouting 'How many times I ask you to be quiet'.
"The defendant punched the complainant to the side of the face and the complainant punched him back.
"The defendant then stood back and pulled put a gun that was pointed at the complainant. He thought the gun was real."

Mr Howes said that the victim was very scared and ran back. He then felt pain in his left shoulder and discovered he had been shot with a pellet.
Police were called to the scene and Stakele was arrested. He admitted in interview that he pulled out the gun and said he bought it three months earlier in Boston.
The victim later told police "I was scared for my life. When he pulled the gun out and aimed it at me I ran. I've never been that scared."
Mindageas Stakele, 25, admitted possession of an imitation firearm between 15 and 18 August this year with intent to cause fear of violence.
The charge related to a black metal BB handgun.
He was given a 12 month jail sentence suspended for two years with 200 hours unpaid work and a three month night time curfew.
He was also ordered to pay £535 towards prosecution costs.
Neil Sands, in mitigation, said that Stakele had an issue with loud music being played in the flat late at night.
"He has expressed regret and remorse and accepts that what he did was a bad thing. He just wanted the man to turn the music down."