Madden, who turned 31 this month, scored 53 goals in 149 appearances for Fleetwood after joining the club from Scunthorpe United in January 2018. He is the club’s record goalscorer in EFL games with 43 strikes.
Pilley told the club website: “Paddy has been a fantastic player for Fleetwood Town Football Club and the decision to allow him to leave has been very difficult.
“Not only is he our record EFL goalscorer, but he’s also been a hugely popular character among the players, staff, and, of course, supporters.
However, all good things come to an end at some point and it’s important we do what’s best for the future of the club.
“As a club, we have a big summer ahead and we intend to strengthen the squad, as well as continue to develop the huge talents we have coming through in our Under-23s and youth Academy.”
Rumours of Stockport’s shock approach emerged on Friday and were confirmed by Simon Grayson after the following day’s draw at Blackpool, when the Town head coach suggested the ball was in Madden’s court.
Pilley added: “Once the offer came in from Stockport, we spoke to Paddy to see how he felt about it all.
“He’s 31 now and taking into consideration his diminishing game-time in recent months we came to an agreement it would be a good time to shake hands, thank him and wish him well for the future.
“Paddy also made it clear the chance to sign a long-term contract was too much of a draw for him and his family, so it’s a deal which suits everyone.
“I’d personally like to thank Paddy for all his efforts and wish him well for the future.”
Madden made 36 Town appearances this season, scoring nine goals. He was made captain when Simon Wiles became interim boss in January and then started Fleetwood’s first four games under Grayson, scoring in two of them.
His last start was in the draw with Charlton Athletic on February 20, when he scored Town’s equaliser.
Madden missed the next two games as one of three players struck down by coronavirus and was then unable to regain his place.
He came off the bench in the last four matches, including Saturday’s derby, as Grayson paired Ged Garner with loanee Kyle Vassell up front. Madden was under contract at Fleetwood until the end of next season.
Stockport have reported that Madden will immediately join in training and is available for tonight’s National League fixture against Barnet.
Manager Simon Rusk told his club’s website: “It gives me great pleasure to welcome Paddy and I am delighted that he has accepted the challenge of helping this team and club grow.
“While his experience, and track record speaks for itself, I am drawn to his attitude and hunger for the game.
“When he walks into our dressing room, he will find similar spirits. We have a strong, together and like-minded group, and this is what makes Paddy a fantastic addition for us.”
Thanks for reading. If you value what we do and are able to support us, a digital subscription is just £1 for your first month. Try us today by clicking here