Michael Somare, Papua New Guinea’s first prime minister, who played a major role in leading the country to independence from Australia, died on Friday at a hospital in Port Moresby, the capital. He was 84.

His death was announced by his daughter Betha Somare, who said he had been admitted to a hospital on Feb. 19 after a diagnosis of late-stage pancreatic cancer.

“Sadly, pancreatic cancer is one of the most aggressive cancers that are rarely detected early,” she said in an emailed statement. “We as a family had only two weeks to look for possible treatments for our father.”

Widely regarded as “papa blo kantri,” the father of the nation, Mr. Somare was the Pacific country’s longest-serving prime minister, over three separate terms — for 17 of its 45 years of independence to date. He was the country’s leader from 1975 to 1980; from 1982 to 1985; and from 2002 to 2011.

Mr. Somare played a pivotal role in navigating the many challenges raised by the country’s disparate tribal groups, Australian expatriates and Australia’s government in the lead-up to independence, wrote Ronald May, an emeritus fellow with the Department of Pacific Affairs at Australian National University.

“Notwithstanding these challenges, Papua New Guinea made a smooth transition to independence in 1975, with Mr. Somare as prime minister, confounding those in Australia and elsewhere who had predicted political and economic collapse,” he wrote. “It remains one of a fairly small number of post-colonial states that have maintained an unbroken record of democracy.”

Prime Minister Scott Morrison of Australia told local reporters on Friday that he had called James Marape, Papua New Guinea’s prime minister, to offer his condolences to Mr. Somare’s family and the country’s people.

“He was the light of his generation which has lighted up the path for Papua New Guineans today and into the future,” Mr. Morrison said.

Mr. Somare was born in April 9, 1936, in Rabaul, East New Britain Province, where his father was stationed as a police officer. The younger Mr. Somare was reared in East Sepik Province, which he would later represent in Parliament.

He worked as a translator and a journalist before entering politics as one of the founders of the Pangu Pati, which acted as an unofficial opposition in Parliament before forming a coalition that led the country to independence.

He served as the chief minister of Papua New Guinea as an Australian-administered territory and, after independence, as its first prime minister.

At a midnight radio address to the new nation, Mr. Somare said: “This is just the beginning. Now we must stand on our own two feet and work harder than ever before. We are indeed masters of our own destiny.”

Mr. Somare spent the last part of his final term in critical care outside Papua New Guinea, during which time he was controversially removed by a group of lawmakers who declared that the role of prime minister was vacant. Mr. Somare officially retired from politics in 2017.

In addition to his daughter Betha, Mr. Somare is survived by his wife, Veronica, whom he married in 1965; and their other children, Sana, Arthur, Michael and Dulciana.

On Friday, Mr. Marape called for “a week of silence, peace and calm as we pay respect to this one person whom our country owes much.”

In a statement, he said, “Our nation honors this great leader, the founding and longest serving prime minister of our country.” Mr. Marape added, “He is unmatched by any one of us who comes after him.”