A man living at an over-50s accommodation threatened to "stab or shoot" people over noise just a day before he killed another resident, a court has heard.
Christopher Stocks, 54, is accused of fatally stabbing Gary Ballett, 66, at the sheltered housing block in Poole, Dorset, on 9 August.
Salisbury Crown Court heard Mr Ballett died a day later from his injuries.
Mr Stocks, who claims self-defence, has pleaded not guilty to murder.
The jury heard police had been called the previous day over a noise dispute at Trinidad House in Rossmore Road.
Mr Stocks had objected to neighbour Barry Tucker - who lived below him - inviting friends, including Gary Ballett, to sit outside his ground-floor flat, it was heard.
'Carrying a bat'
Prosecuting, Alastair Malcolm QC told the court the defendant shouted out from his window "if you don't shut up, I'm going to come down and stab you or shoot you".
Mr Stocks had also told a 999 call handler "if you don't do something, I'm going to take a knife out there", Mr Malcolm said.
But when police arrived they found no cause for action to be taken.
The following day, Mr Ballett had gone into Mr Stock's block to see if another resident wanted to join a group outside Mr Tucker's flat, before a confrontation ensued, jurors were told.
At about 19:40 BST, police officers found Mr Ballett conscious on the ground outside the block when he told them he had been stabbed by Mr Stokes with a knife up to seven inches long, the court heard.
After being arrested, Mr Stocks told police Mr Ballet, a resident unknown to him, burst into his flat carrying a bat in an aggressive manner and would not leave, Mr Malcolm said.
Mr Stocks added he grabbed a knife but had no intention of stabbing Mr Ballett.
Prosecutor Mr Malcolm said witnesses did not see Mr Ballett holding a bat and neither was one found. He added three superficial wounds found on Mr Stocks were "self-inflicted".
The trial continues.