Pedro I was a 74-gun ship of the line of the Imperial Brazilian Navy. She was a third-rate, three-masted, two-decked ship. The ship was built by Antônio da Silva in the Bahia Navy Arsenal as a 70-gun ship of the line for the Portuguese Navy in 1763. First named Santo António e São José, she took part in several naval actions in the decades after its construction such as the bombardment of Algiers in 1784.

Renamed Martim de Freitas in 1806, she was part of the fleet involved in the transfer of the Portuguese court to Brazil during the Franco-Spanish invasion of Portugal. After the Brazilian War of Independence broke out, she was seized by the Brazilians and incorporated into the newly formed Brazilian navy to fight against the Portuguese as its first flagship. Under Thomas Cochrane, Brazil's first admiral, she took part in the battle of 4 May off Salvador.

During the Cisplatine War, she was tasked with transporting Pedro I of Brazil to southern Brazil; however, due to the death of Maria Leopoldina of Austria, the emperor's wife, the ship returned to Rio de Janeiro and did not take part in any further naval actions. Pedro I served her final years as a prison ship, being scrapped in 1833 after about 70 years of service.

Design The ship's keel measured 60m, 14m of beam, 12m of depth and 6.37m of draft. It was rigged as galera (ship-rigged), that is, it hoisted three robust masts. When first built, it had three spacious battery packs, with 70 hatches armed with carronades and culverins of heavy and medium caliber. Its first battery deck consisted of twenty six 24-pounder guns; the second battery deck consisted of twenty six 12-pounder guns; the aftercastle was armed with two 12-pounder, eight 9-pounder and four 1-pounder guns. It also had an additional four 1-pounder guns. Its crew, made up of sailors and troops, must have numbered between 600 and 700 men. As a symbol of fidelity, it had a dog as its figurehead, for which its sailors often referred to the ship as "Cão" (dog).

Construction The ship was built at the by shipbuilder Antônio da Silva. The keel was laid on 1 October 1760 and it was named, according to the tradition of the time, to the double blessing of Anthony of Padua and Saint Joseph. Construction work lasted for twenty-eight months; its launch took place on 29 January 1763, during the government of , the 6th Count of Arcos and 7th Viceroy of Brazil. The total construction cost was 134,904,283 réis.

Service In the Royal Portuguese navy In southern Brazil

Upon its completion, Santo António e São José departed for Santa Catarina in southern Brazil after completing a trip to Lisbon. The Portuguese expected Spanish attacks in the region and also planned to reconquer the part of the territory of present-day Brazilian state of Rio Grande do Sul that had been occupied by Spain as a result of the Fantastic War. This prompted the formation of a naval division to be stationed in Santa Catarina, with Santo António e São José as its flagship, in order to provide support for the troops on land and patrol the coast. The commander of such division was Irish officer . The commander of Santo António e São José was captain of sea and war José da Silva Pimentel.

The instructions sent on 9 August 1774 by the Marquis of Pombal to the Viceroy of Brazil, Luís de Almeida Portugal, the 2nd Marquis of Lavradio, read:

By 1 February 1775, the squadron had already reached Santa Catarina, with Santo António e São José serving as its flagship. The following year, on 6 February 1776, at 15:00, Santo António e São José sailed from Santa Catarina towards Rio Grande do Sul accompanied by nine vessels: two frigates, two corvettes, three smacks, a brig and a sloop. Part of the Santa Catarina Regiment embarked on these ships, this regiment was known as Barriga Verde, "Green Belly". The squadron reached its destination on 14 February, anchoring away from the coast. The next day, MacDouall went ashore in order to meet with the Army Commander in Operations.

Shortly after, heavy winds hit the squadron from the southeast, causing a lot of issues to it, as it was anchored outside the port, which was occupied by both naval and land Spanish forces. In the morning of 19 February, the squadron, headed by Santo António, entered the port and attacked the enemy naval forces stationed there the next day. In addition to some wounded, eight soldiers died in the combat. On 1 April of that same year, a new attack was carried out on the port's fortifications and naval forces. This attack ended in a Luso-Brazilian victory, as it gave them complete possession of Rio Grande do Sul.

Spanish attack on Santa Catarina island

By the end of 1776, a large Spanish fleet consisting of 20 warships and 97 transport ships carrying 12 thousand soldiers divided into four brigades, was sailing in the southern Brazilian coast. The fleet was commanded by admiral Antonio Barceló and the troops were commanded by Pedro de Cevallos, viceroy of the Río de la Plata. Their goal was to take control of Portuguese possessions in the region. The fleet was armed with a total of 674 guns, carrying 5,148 sailors and 1,308 marines on board.

On 6 February 1777, this fleet seized three Portuguese ships off the Brazilian coast. The Spaniards found official reports in the ships detailing the precarious state of Portuguese defenses in Santa Catarina Island and decided to attack and take control of it. Only on 17 February did the Portuguese notice the approach of the Spaniards. On 20 February, chief MacDuall gathered a council of commanders on board Santo António. One of them, a Portuguese admiral, was willing to fight the Spanish forces, but the instructions that had been sent to him by the 2nd Marquis of Lavradio ordered not to risk their fleet.

Out of the commanders, captain of sea and war José de Melo Brayner was the only one that voted to fight. The Portuguese then withdrew from the island, which was taken effortlessly by the Spaniards. Cevallos left a garrison on the island and sailed south, reaching Colonia del Sacramento on 22 May. The Portuguese fleet still patrolled the coast from time to time however. On 20 April 1778, Santo António, together with the ship of the line Prazeres, seized the Spanish ships San Agustín and Sant'Anna after a fierce combat off the coast of Santa Catarina, taking 750 prisoners.

In Europe Bombardment of Algiers

In the 18th century, Barbary corsairs – especially Algerians – began raiding ships in the Mediterranean and on the western coast of the Iberian Peninsula. The peace treaty that Charles III of Spain celebrated with the Ottoman Empire did not stop corsair attacks on Spanish ships. As a result, a Spanish fleet, under the command of Antonio Barceló, carried out the bombardment of Algiers in 1783, which did little to stop the corsairs. It was then agreed that a new allied fleet, consisting of Spanish, Portuguese, Neapolitan and Maltese ships would attack Algiers.

On 23 May 1784, was appointed commander of Santo António e São José; on 13 June, the ship carried out an armament display, having 421 men on board. The small Portuguese fleet that joined the allied naval forces consisted of the ships of the line Santo António e São José and Nossa Senhora do Bom Sucesso and the frigates Golfinho and Tritão. It departed from the port of Lisbon on 18 June and joined the rest of the allied fleet in Algiers on 12 July 1784, attacking it that same day.

Final years in the Portuguese navy

On 1 April 1794, back in Lisbon, the ship underwent general repairs and modernization; the works were completed on 14 June and the ship was renamed Infante D. Pedro Carlos in honor of the Spanish prince Pedro Carlos of Spain and Portugal, nephew of Portuguese prince John, future consort of Maria Teresa of Braganza, the Princess of Beira, and General Admiral of the Royal Portuguese Navy.

After a series of trips from Europe to Brazil in the following years, D. Pedro Carlos once again underwent repairs in 1806, being renamed Martim de Freitas. With the Napoleonic Wars raging in Europe and the subsequent French invasion of Portugal, the Portuguese royal family decided to flee to Brazil bringing with it its court. D. Pedro Carlos was part of the fleet that brought the royal family to Brazil, departing from Lisbon on 29 November 1807 and reaching Rio de Janeiro in March 1808. Upon their arrival, the Portuguese ships, including D. Pedro Carlos, fell into disrepair and were left anchored in Rio de Janeiro.

In the Imperial Brazilian navy Brazilian War of Independence

After the return of king John VI to Portugal as a result of the Revolution of Porto, a letter of 26 October 1821 ordered Prince Regent Pedro, his son, to make all the ships stationed in Brazil ready to return to Lisbon. These included the ships of the line Martim de Freitas, and . Perhaps the Portuguese cortes, already fearing independence movements in Brazil, wanted to secure control of the ships.

Martim de Freitas was undergoing repairs in Rio de Janeiro. On 7 September 1822, prince Pedro proclaimed Brazil's independence from Portugal in what became known as the Cry of Ipiranga. Hostilities between Brazilians and the Portuguese were already happening all over Brazil. Pedro quickly set out to create a naval force capable of facing off the Portuguese forces in Brazil and the ones that could eventually be sent from Europe in order to keep the territorial integrity of the empire. Brazil's finance minister, Martim Francisco Ribeiro de Andrada, created a national subscription campaign to fund the acquisition of a war fleet and repair the existing ships. Martim de Freitas, whose repairs were almost finished, was rearmed and incorporated into the newly formed Imperial Brazilian Navy, being renamed Pedro I in honor of Brazil's first emperor. On 10 November 1822 it hoisted the flag of the Empire of Brazil for the first time, which was accompanied by a cannon salvo.

The most serious problem faced by Brazilian authorities during the formation of the Brazilian Navy was the severe shortage of officers. The government decided to hire foreign officers, especially British and French ones. The most prominent among them was Thomas Cochrane, who had recently arrived in Brazil after fighting the Spaniards in the Chilean War of Independence. By decree of 21 March 1823 Cochrane was given command of the Brazilian Navy in the war against Portugal, becoming Brazil's first admiral. Cochrane chose Pedro I to be the navy's flagship. The admiral hoisted his flag on the ship that same day, having remarked:

On 3 April 1823, Pedro I departed from Guanabara Bay for Bahia in order to blockade the Portuguese forces stationed there and support general Pierre Labatut's forces on land. Its commander was frigate captain Thomaz Sackville Crosbie. Crosbie's staff included admiral Cochrane, secretary and first lieutenant Victor Santiago Subrá, captain lieutenant John Pascoe Grenfell, first lieutenant William Eyre, second lieutenant William Parker, midshipman Pedro Paulo Boutrolle, commissar José Cristóvão Salgado, chaplain Marista Augusto de Santa Rita and scrivener Manoel Fernandes Pinto. Apart from Pedro I, Cochrane's fleet also consisted of the frigates Piranga and Niterói, the brigs Real Pedro and Guarani, and the corvettes Maria da Glória and Liberal.