HMS Raven was a Cruizer-class brig-sloop built by Perry, Wells and Green at Blackwall Yard and launched in 1804. Although she embodied some interesting innovations tailored for service in the area of the Straits of Gibraltar, she was wrecked before she got on station and never tested them. Her captain, the innovator, was the subject of a miscarriage of justice at his court martial for the loss of the ship from which his career never recovered.
She was commissioned under Commander William Layman in August. Based on his experience in the Straits of Gibraltar with Weazel he suggested some modifications to existing vessels that would make them more successful in that area. Weazel, with Layman in command, had been wrecked on 1 March 1804 when a gale drove her near Cabritta Point in Gibraltar Bay and smashed to pieces, with the loss of one man killed. Layman was a protégé of Lord Nelson, with whom he had served in three ships, and with Nelson’s support he was allowed to implement some of his ideas.
Layman only had time to make changes to Raven's armament. He closed the two foremost ports and replaced their guns with a single 68-pounder carronade that he mounted on a traverse carriage (i.e., pivot-mounted) immediately before the foremast in a way that it could fire over the gunwales. Similarly, a second 68-pounder, also mounted on a traverse, replaced the two stern chasers. Should gunboats threaten a becalmed Raven, she could present a powerful response on any azimuth.
On 21 January 1805 Raven sailed to join Lord Nelson's squadron with dispatches for him and for Sir John Orde off Cadiz.. She arrived at the rendezvous on 29 January, some two to ten leagues off Cadiz, however Orde's squadron was not there.
Layman reduced sail and hove to for the night. A leadline sounding was taken, which showed that there was no bottom at 80 fathoms (150 m). He assumed that Raven was well offshore and retired, leaving instructions that the watch should throw the lead every half hour.
At about midnight the officer of the watch called with the news that he had sighted the lights of the squadron. Before he could get on deck the officer of the watch came down the ladder, apparently agitated, and reported that the lights were those of Cadiz, not the squadron. Layman immediately went on deck and ordered a sounding be taken. It showed 10 fathoms (18 m), rapidly shoaling to 5 fathoms (9 m) as he turned Raven about.
At daylight Layman discovered that Raven was close inshore with Spanish warships at anchor off Cadiz on the one side and batteries in a fort at Santa Catalina on the other. Unwilling to surrender, and in spite of a strong wind from the west, he managed to clear the shoals. However, the main yard broke "in the slings" and Layman was forced to anchor Raven off Rota. The wind increased to gale strength and eventually the heavy seas caused the anchor cables to part. The gale then threw Raven onto the beach at Santa Catalina. Layman threw the despatches he was carrying overboard, weighted with 32-pounder shot. He lost only two men; they had disobeyed his orders and drowned while trying to reach shore at the height of the gale during the high tide. Once the tide receded it was easy for the crew to land on the beach.
Raven herself was unsalvageable, though the Spaniards were able to recover her carronades. The Spanish took the crew prisoner but permitted the officers to move freely within a radius of 200 nautical miles (370 km). Shortly thereafter the officers were exchanged.
While in Spanish custody Layman made inquiries amongst the crew. He discovered that the watch had neglected his instructions to use the leadline every half-hour. Furthermore, the officer of the watch had been below, drunk, when the lookouts first spotted the lights.
When Layman was back in Gibraltar he shared his findings with Nelson, but Nelson advised Layman not blame his boatswain, master and officer of the watch. Nelson feared that the officer of the watch would receive a death sentence for his conduct. Nelson assured Layman that "You will not be censured."
However, Nelson had misjudged the situation. The court martial on 9 March 1805 ordered Layman to be reprimanded severely and sentenced him to loss of seniority. The court martial minutes include a note by an Admiralty official that, "Their Lordships are of the opinion that Captain Layman is not a fit person to be entrusted with the command of one of H.M.'s ships."
There was one member of the court martial who was particularly adamant the Layman be censured. Layman may have annoyed some senior officers with his outspoken suggestions for improvements to the Navy and its ships.
Layman appealed his sentence, with support from Nelson, but the Admiralty was not willing to overturn the court martial verdict. Nelson was killed at Trafalgar in October 1805 and so could not plead further Layman's case.
Subsequent courts martial dealt with Layman’s officers. The court martial board judged that the master, John Edwards had been negligent in not taking regular soundings and in not monitoring Raven's movements. He was barred for two years from being able to sit for the examination for promotion to lieutenant. The court martial of Raven's second lieutenant, who had been the officer of the watch, resulted in his being dismissed from the service.