Why was Perth chosen to be the capital of Western Australia?

Perth was founded in 1829, and initially it was called the Swan River settlement.

In 1829, Captain Charles Fremantle was sent to take formal possession of the remainder of New Holland which had not already been claimed for Britain under the territory of New South Wales. On 2 May 1829, Captain Fremantle raised the Union Jack on the south head of the Swan River, thereby claiming the territory for Britain. The Swan River was the logical choice because it was a good port for ships.