A stash of drugs was found after police raided a house in the early hours of the morning, Lincoln Crown Court was told.
Officers had previously received information relating to a VW Golf car and approached the vehicle when it was seen in Lytham Close, Grantham in August 2017.
John Hallissey, prosecuting, said that the driver Robert Lockton ran off when officers began to search the car.
Mr Hallissey said: “The defendant ran inside his home in the close. One of the officers chased after him and eventually the defendant opened the door and came outside.
“A search was carried out of the house. In the kitchen cupboard they found a safe inside which were large amounts of Class A drugs.”
Mr Hallissey said that crack cocaine and heroin valued at £9,000 was recovered.
Digital scales containing traces of MDMA, heroin and crack cocaine were also found.
Police also found a CS gas canister in a cupboard in the kitchen.
Thomas Barton, the passenger in the VW Golf, was also arrested. His fingerprints were found on the digital scales and when he was searched after being taken into custody three wraps of crack cocaine and a wrap of heroin were found on him.
Lockton, 32, now of Hornsby Road, Grantham, and Barton, 24, of Uplands Drive, Grantham, each admitted two charges of conspiracy to supply drugs. Lockton also admitted possession of the CS gas canister which is a prohibited weapon.
Michael Cranmer-Brown, for Lockton, said “He has lost the very nice home he had on an estate in Grantham. The car he had was seized by the police.
“In 2019 he was seriously ill. He was in intensive care for seven days. He was too ill to work for about six months so he has had a difficult time.”
Stuart Lody, for Barton, said that at the time his client was arrested he was in “a sorry state”.
“His relationship broke down. He was taking cocaine, lost his job and fell into debt with his dealer.
“Then having got himself off cocaine the debt he owed to his dealer remained.”
Both men were remanded in custody and the hearing was adjourned to February 27.