A Royal Navy petty officer accused of raping a female colleague has told a court martial the sex was consensual.
HMS Nelson is the Navy's main base in Portsmouth
Chief Petty officer Phillip Coates, 30, from Devon, denies a charge of raping the 24-year-old while at sea.
The married medical assistant told the hearing at HMS Nelson, Portsmouth Naval Base, that his alleged victim willingly had sex after a barbecue on the ship.
This is believed to be the first time a navy petty officer has faced a trial accused of raping a female colleague.
The rape is alleged to have happened while Mr Coates was at sea in the Mediterranean in March last year.
On Thursday, he told the hearing that he and the female junior rating started kissing on the ship's quarterdeck after the barbecue.
The party had been held to mark the completion of a training exercise.
Mr Coates told the court that when they were disturbed by others arriving on the quarterdeck, he followed his alleged victim into a small room between decks where they had sex.
He admitted that having sex while on board a ship put his eight-month marriage, his rank and job at risk.
He told the court martial he had drunk a glass of red wine and six cans of Carling lager during the barbecue and felt "merry" but not drunk.
Peter Glenser, prosecuting, asked him: "Had all sense and reason left your head?" to which he replied: "I knew what I was doing."
Mr Coates added that he did not think that the alleged victim, who admitted drinking a bottle of rose wine, two glasses of punch and a vodka and lemonade that evening, was drunk.
The case continues.