The book, a copy of which was obtained Thursday by The Associated Press, the Polish pontiff also said his would-be assassin, Mehmet Ali Agca, "understood that above his power - the power of shooting and killing - there is a greater power."
In "Memory and Identity: Conversations Between Millenniums," the pope said he remembered being rushed to the hospital but didn't recall much of what happened after he arrived because "I was almost on the other side."
"Oh, my Lord! This was a difficult experience. I woke up the next day, around noon," John Paul wrote.
The book, his fifth, is essentially a transcript of conversations he had in Polish with his close friends political philosopher Krzysztof Michalski and the late Rev. Jozef Tishner in 1993 at his summer residence near Rome. It will be published Feb. 23 in Italy by Rizzoli, which also plans an English version soon for the United States.
In it, the pope reflected on a range of topics and broadly compares abortion to the Holocaust, saying both derived from governments in conflict with God's laws.
The most personal section of the book contains John Paul's recollections of how his faith sustained him after being shot in the abdomen by the Turkish gunman on May 13, 1981, while riding in an open car in St. Peter's Square.
"Yes, I remember that journey to the hospital," he wrote. "I remained conscious for some time after. I had a feeling that I would I would survive. I was in pain, I had reason to be afraid, but I had this strange felling of confidence."
Before reaching the hospital, he told his personal secretary, the Rev. Stanislaw Dziwisz, now an archbishop, that "I forgive the assassin," according to the book.
John Paul recalled his belief that the bullet was steered away from vital organs by divine intervention - which he has credited to the Virgin Mary of Fatima. Three shepherd children say the Virgin Mary appeared to them in Fatima, Portugal, in 1917 and made several predictions. Church officials said in 2000 that one of them foretold the assassination attempt on John Paul.
"Agca knew how to shoot and he shot with confidence, with perfection. But it was just as if someone guided this bullet," the pope said.
The pope also described his meeting with Agca at Christmas 1983 in a Rome prison, a talk that gave John Paul the feeling that he had somehow reached his would-be killer.
"We talked for a long time. Ali Agca is, as everyone says, a professional assassin. Which means that the assassination was not his initiative, that someone else thought of it, someone else gave the order," he wrote.
"During the entire conversation, it was clear that Ali Agca was burdened by the question: How did it happen that the assassination was unsuccessful? He did everything that was necessary, he took care of the tiniest detail of his plan. But still the victim avoided death. How could this have happened?"
During their talk, Agca grew interested in the secret of Fatima, the pope wrote.
"And a very curious thing ... this unrest led him to the issue of religion. He asked how it really is with this Fatima mystery. What is it based on? That was his main point of his interest, this is what he most of all wanted to find out," the pope says.
The pope went on: "Ali Agca - as I believe - understood, that above his power, the power of shooting and killing there is a greater power. He began looking for it. I wish for him that he finds it."
Agca was extradited to Turkey after serving almost 20 years for the shooting and remains imprisoned for other crimes. During John Paul's 10-day hospitalization this month for breathing problems and flu, Agca wished the 84-year-old pontiff well.
While John Paul did not say who he thought ordered the assassination attempt, he called it "one of the last convulsions of the 20th century ideologies of force. Force stimulated fascism and Hitlerism, force stimulated communism."
There has been speculation that agents from Bulgaria helped plot the assassination attempt because of that country's ties with the Soviet KGB, which reportedly was alarmed by the pope's support for the Solidarity trade union in Poland. In 2002, however, John Paul sought to lay the issue to rest, declaring he never believed there was a Bulgarian connection to Agca.
On other topics, the pope says the Holocaust and abortion both came about when people decided to usurp "the law of God."
"It was a legally elected parliament which allowed for the election of Hitler in Germany in the 1930s and then the same Reichstag that gave Hitler powers which paved a way for the political invasion of Europe and to the creation of concentration camps and for introducing the so-called 'final solution' of the Jewish question, which meant the extermination of millions of sons and daughters of Israel."
The pope continued, "We have to question the legal regulations that have been decided in the parliaments of present day democracies. The most direct association which comes to mind is the abortion laws. ... Parliaments which create and promulgate such laws must be aware that they are transgressing their powers and remain in open conflict with the law of God and the law of nature."
In the book, the pope said the countries freed from Soviet domination and communist rule at the end of the Cold War - including his native Poland, which is overwhelmingly Roman Catholic - must resist cultural influences from largely secular Western Europe.
"The basic threat facing Central Europe now is having its identity subdued. ... What is the risk?" he wrote. "It is uncritically falling under the influence of negative cultural patterns spread in the West."
He wrote that during the struggle against communism, "this part of Europe has completed a task of spiritual maturing thanks to which certain values important for human life were devalued less than in the West. There the conviction that God is the highest guarantor of human dignity and man's rights is still alive."
An advance Polish-language copy of the book, which goes on sale in Poland on March 11, was made available to the AP by the Krakow-based publishing house Znak.
The pope's first book, "Crossing the Threshold of Hope," came out a decade ago and sold 20 million copies as an international best seller. Proceeds from his books go to charity.
By Vanessa Gera