Cadell Heney (L) and Ryan Carroll (R) admitted all charges at the Court Martial in Devonport on Monday.

A young sailor was caught dealing drugs at Devonport Naval Base after test cheating accusations attracted Military Police attention.

Drug-related text chatter dug up in a cellphone search led to Ordinary Weapon Technician Cadell Heney​ and a comrade being hauled before the Court Martial of New Zealand.

Heney and Ordinary Electronic Technician Ryan Conrad Carroll on Monday afternoon pleaded guilty to all charges at the Court Martial, held at Devonport, Auckland.

ABIGAIL DOUGHERTY/STUFF Cadell Heney admitted 12 charges.

Heney​ admitted 12 charges including supplying MDMA, procuring it, conspiring to supply the drug, and offering to supply the same drug.

READ MORE:

* Soldiers scam Army meals and travel, fiddle database to cover tracks

* Ex-SAS soldier found not guilty of assaulting man in a bar

* Five soldiers discharged from army after taking psychedelic drug 'N-Bomb'

He also admitted a charge of doing an act likely to prejudice service discipline by using his cellphone to record pages of a test paper "with intent to gain an advantage" before taking a test.

FILE The sailors were caught dealing at Devonport Naval Base on Auckland's North Shore.

Junior Crown Prosecutor Lt Matthew Hague said in late 2018, Heney was taking a course at the base.

Hague told the Court Martial a petty officer at Devonport, on Auckland's North Shore, received a complaint about people copying test results.

Heney's phone was seized and searched, and Heney admitted he had taken video of the test.

ABIGAIL DOUGHERTY/STUFF Heney and his co-accused pleaded guilty soon after being marched into the Court Martial on Monday.

"He acknowledged that this was the wrong thing to do," Hague told the Court Martial.

The phone was sent to Military Police, where a technician noticed text messages that indicated possible drug offending.

The Court Martial heard various intercepted texts on the phone included chatter such as "Can I just give you cash when I see you?" and "Do you have any pills?"

Hague said both sailors made multiple admissions after being confronted with the cellphone data.

Three of Heney's drug offences happened in Hawke's Bay, five at an Auckland location unspecified in charge sheets, and three at the naval base.

Heney admitted paying Carroll for MDMA capsules.

Some charges related to Heney supplying just one MDMA capsule.

Carroll, 23, entered guilty pleas to all five charges he faced on Monday.

He was accused of procuring MDMA and supplying MDMA capsules.

The two ratings' pleas were entered after they were marched in at about 3.15pm before Chief Judge Kevin Riordan.

Heney and Carroll have yet to be sentenced.

The Court Martial continues on Tuesday.