The late Allameh Tabatabaei says that intercession is a rational issue and a means of lifting punishment or gaining higher ranks. He says:

“If man intends to attain spiritual perfection and gain material and spiritual blessing that in view of social criteria he lacks readiness or means of realizing them, or if he wants to repel evil from himself, but he is unable to fulfill what he is bound to, he turns to intercession.”

Therefore when God forgives a repenting sinful through intercession, there is no contradiction in this decision. God has full knowledge of His servants.

Allameh Tabatabaei clarifies the point via an interesting example:

“As an example, we all know that darkness befalls on earth at night. Knowing this, we decide to use electrical tools such as lamps. Then we turn off the light in daylight. In this example, we have two plain truths: Night lacks light and day has light. Based on these two understandings, we have two wills and have done two things. We lit the light on at night and put it off in daytime. In this example, the second knowledge and will does not negate the first. Due to the difference in the subject, the second will has taken place in conformity with the first. No one can ever imagine the phantom he sees is a tree and after getting closer to it he finds out that he has made a mistake and the phantom was an animal not a tree. This is because the second knowledge is contradictory to the first.”