A man armed with a sawn-off shotgun fired shots at a car in which his former girlfriend was a passenger, a court was told.
Aaron Brown was allegedly in a silver Ford Focus in St James Street, Wolverhampton, when a total of three shots were exchanged with a black Peugeot, a jury at Wolverhampton Crown Court heard.
The 31-year-old had been in the Empire Club in nearby Ward Street prior to the alleged incident in the early hours of the morning of October 28.
Mr Adam Western, prosecuting, said: "Brown was involved in a shooting in Wolverhampton city centre.
"Not only did he shoot at others, it is likely that he was also shot at."
The court was told police were dealing with a separate incident in nearby Walsall Street when officers heard what they thought was gun shots ringing out.
"When they attended the scene they saw a black Peugeot leaving St James Street and gave chase," said Mr Western.
"They stopped the car and saw that the driver's window was smashed and there was a large bullet hole in the frame of the passenger door.
"Shell casings were recovered from the driver's footwell."
Mr Western said three people were in the car, one of whom was Brown's former partner.
When police seized her phone they found it to contain a threatening text message, which the prosecution alleges was sent from a phone belonging to Brown.
A short time after the incident a silver Ford Focus belonging to Brown was seen driving onto the car park of Jennings Funeral Directors on St James Street.
Mr Western continued: "A witness saw a male exit the driver's side of the car and run to the far side of the car park.
"He deposited something before returning to the car and driving off at speed towards Walsall Street."
Police officers attending the scene recovered a Sports Direct bag containing a double-barrelled sawn-off shotgun, the court heard.
One of its barrels had been discharged while the other contained a live cartridge.
The bag also contained three other live cartridges.
The following day, police recovered the Ford Focus from the Parkfields area, where it had been abandoned.
"The car was damaged consistent with being shot at," added Mr Western.
"When police further examined the interiors of both the Ford and the Peugeot they found them to contain impact damage lead projectiles.
"This is consistent with shots having been fired from both vehicles."
Mr Western said Brown reported his car stolen on October 29, claiming he had not seen it since Sunday.
Brown was arrested at an address in Renton Road on October 3 and his property was seized, including three mobile phones, £500 in cash and 23 grammes of cocaine with a street value of £1,500.
Brown, of Julian Road, Wolverhampton, denies possession of a firearm with intent to endanger life and possession of a Class A drug.
The trial continues.